using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace SqlSugar.Odbc { public class OdbcDbBind : DbBindProvider { public override string GetDbTypeName(string csharpTypeName) { if (csharpTypeName == nameof(DateTimeOffset)) { return nameof(DateTimeOffset); } else { return base.GetDbTypeName(csharpTypeName); } } 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("bigint",CSharpDataType.@long), new KeyValuePair("blob",CSharpDataType.byteArray), new KeyValuePair("boolean",CSharpDataType.@bool), new KeyValuePair("byte",CSharpDataType.@byte), new KeyValuePair("varchar", CSharpDataType.@string), new KeyValuePair("char",CSharpDataType.@string), new KeyValuePair("clob",CSharpDataType.@string), new KeyValuePair("DATETIME YEAR TO FRACTION(3)", CSharpDataType.DateTime), new KeyValuePair("datetime", CSharpDataType.DateTime), new KeyValuePair("date", CSharpDataType.DateTime), new KeyValuePair("decimal", CSharpDataType.@decimal), new KeyValuePair("float", CSharpDataType.@float), new KeyValuePair("int", CSharpDataType.@int), new KeyValuePair("integer", CSharpDataType.@int), new KeyValuePair("money", CSharpDataType.@decimal), new KeyValuePair("nchar", CSharpDataType.@string), new KeyValuePair("numeric", CSharpDataType.@decimal), new KeyValuePair("nvarchar", CSharpDataType.@string), new KeyValuePair("varchar", CSharpDataType.@string), new KeyValuePair("text", CSharpDataType.@string), new KeyValuePair("smallfloat", CSharpDataType.@decimal), new KeyValuePair("serial", CSharpDataType.@int), }; }; }