using System.Collections.Generic; using System.Linq; namespace SqlSugar { public class SqlServerDbBind : DbBindProvider { public override List> MappingTypes { get { var extService = this.Context.CurrentConnectionConfig.ConfigureExternalServices; if (extService != null&& extService.AppendDataReaderTypeMappings.HasValue()) { return extService.AppendDataReaderTypeMappings.Union(MappingTypesConst).ToList(); } else { return MappingTypesConst; } } } public static List> MappingTypesConst = new List> { new KeyValuePair("int",CSharpDataType.@int), new KeyValuePair("varchar",CSharpDataType.@string), new KeyValuePair("nvarchar",CSharpDataType.@string), new KeyValuePair("sql_variant",CSharpDataType.@string), new KeyValuePair("text",CSharpDataType.@string), new KeyValuePair("char",CSharpDataType.@string), new KeyValuePair("ntext",CSharpDataType.@string), new KeyValuePair("nchar",CSharpDataType.@string), new KeyValuePair("hierarchyid",CSharpDataType.@string), new KeyValuePair("bigint",CSharpDataType.@long), new KeyValuePair("bit",CSharpDataType.@bool), new KeyValuePair("datetime",CSharpDataType.DateTime), new KeyValuePair("time",CSharpDataType.DateTime), new KeyValuePair("smalldatetime",CSharpDataType.DateTime), new KeyValuePair("timestamp",CSharpDataType.byteArray), new KeyValuePair("datetime2",CSharpDataType.DateTime), new KeyValuePair("date",CSharpDataType.DateTime), new KeyValuePair("decimal",CSharpDataType.@decimal), new KeyValuePair("single",CSharpDataType.@decimal), new KeyValuePair("money",CSharpDataType.@decimal), new KeyValuePair("numeric",CSharpDataType.@decimal), new KeyValuePair("smallmoney",CSharpDataType.@decimal), new KeyValuePair("float",CSharpDataType.@double), new KeyValuePair("float",CSharpDataType.Single), new KeyValuePair("real",CSharpDataType.@float), new KeyValuePair("smallint",CSharpDataType.@short), new KeyValuePair("tinyint",CSharpDataType.@byte), new KeyValuePair("uniqueidentifier",CSharpDataType.Guid), new KeyValuePair("binary",CSharpDataType.byteArray), new KeyValuePair("image",CSharpDataType.byteArray), new KeyValuePair("varbinary",CSharpDataType.byteArray), new KeyValuePair("datetimeoffset", CSharpDataType.DateTimeOffset), new KeyValuePair("datetimeoffset", CSharpDataType.DateTime)}; }; }