public SqlServerStringsTypeMapper( RelationalTypeMapperDependencies dependencies) : base(dependencies) { _storeTypeMappings = new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase) { { "national char varying", _variableLengthUnicodeString }, { "national character varying", _variableLengthUnicodeString }, { "nvarchar", _variableLengthUnicodeString } }; _clrTypeMappings = new Dictionary <Type, RelationalTypeMapping>(); StringMapper = new StringRelationalTypeMapper( maxBoundedAnsiLength: 4000, defaultAnsiMapping: _unboundedUnicodeString, unboundedAnsiMapping: _unboundedUnicodeString, keyAnsiMapping: _keyUnicodeString, createBoundedAnsiMapping: size => new SqlServerStringTypeMapping( "nvarchar(" + size + ")", dbType: null, unicode: true, size: size), maxBoundedUnicodeLength: 4000, defaultUnicodeMapping: _unboundedUnicodeString, unboundedUnicodeMapping: _unboundedUnicodeString, keyUnicodeMapping: _keyUnicodeString, createBoundedUnicodeMapping: size => new SqlServerStringTypeMapping( "nvarchar(" + size + ")", dbType: null, unicode: true, size: size)); }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public SqlServerTypeMapper([NotNull] RelationalTypeMapperDependencies dependencies) : base(dependencies) { _storeTypeMappings = new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase) { { "bigint", _long }, { "binary varying", _variableLengthBinary }, { "binary", _fixedLengthBinary }, { "bit", _bool }, { "char varying", _variableLengthAnsiString }, { "char", _fixedLengthAnsiString }, { "character varying", _variableLengthAnsiString }, { "character", _fixedLengthAnsiString }, { "date", _date }, { "datetime", _datetime }, { "datetime2", _datetime2 }, { "datetimeoffset", _datetimeoffset }, { "dec", _decimal }, { "decimal", _decimal }, { "float", _double }, { "image", _variableLengthBinary }, { "int", _int }, { "money", _decimal }, { "national char varying", _variableLengthUnicodeString }, { "national character varying", _variableLengthUnicodeString }, { "national character", _fixedLengthUnicodeString }, { "nchar", _fixedLengthUnicodeString }, { "ntext", _variableLengthUnicodeString }, { "numeric", _decimal }, { "nvarchar", _variableLengthUnicodeString }, { "real", _real }, { "rowversion", _rowversion }, { "smalldatetime", _datetime }, { "smallint", _short }, { "smallmoney", _decimal }, { "text", _variableLengthAnsiString }, { "time", _time }, { "timestamp", _rowversion }, { "tinyint", _byte }, { "uniqueidentifier", _uniqueidentifier }, { "varbinary", _variableLengthBinary }, { "varchar", _variableLengthAnsiString }, { "xml", _xml } }; // Note: sbyte, ushort, uint, char and ulong type mappings are not supported by SQL Server. // We would need the type conversions feature to allow this to work - see https://github.com/aspnet/EntityFramework/issues/242. _clrTypeMappings = new Dictionary <Type, RelationalTypeMapping> { { typeof(int), _int }, { typeof(long), _long }, { typeof(DateTime), _datetime2 }, { typeof(Guid), _uniqueidentifier }, { typeof(bool), _bool }, { typeof(byte), _byte }, { typeof(double), _double }, { typeof(DateTimeOffset), _datetimeoffset }, { typeof(short), _short }, { typeof(float), _real }, { typeof(decimal), _decimal }, { typeof(TimeSpan), _time } }; // These are disallowed only if specified without any kind of length specified in parenthesis. // This is because we don't try to make a new type from this string and any max length value // specified in the model, which means use of these strings is almost certainly an error, and // if it is not an error, then using, for example, varbinary(1) will work instead. _disallowedMappings = new HashSet <string>(StringComparer.OrdinalIgnoreCase) { // binary "binary", // varbinary "binary varying", "varbinary", // char "char", "character", // varchar "char varying", "character varying", "varchar", // nchar "national char", "national character", "nchar", // nvarchar "national char varying", "national character varying", "nvarchar" }; ByteArrayMapper = new ByteArrayRelationalTypeMapper( maxBoundedLength: 8000, defaultMapping: _unboundedBinary, unboundedMapping: _unboundedBinary, keyMapping: _keyBinary, rowVersionMapping: _rowversion, createBoundedMapping: size => new SqlServerByteArrayTypeMapping( "varbinary(" + size + ")", DbType.Binary, size)); StringMapper = new StringRelationalTypeMapper( maxBoundedAnsiLength: 8000, defaultAnsiMapping: _unboundedAnsiString, unboundedAnsiMapping: _unboundedAnsiString, keyAnsiMapping: _keyAnsiString, createBoundedAnsiMapping: size => new SqlServerStringTypeMapping( "varchar(" + size + ")", DbType.AnsiString, unicode: false, size: size), maxBoundedUnicodeLength: 4000, defaultUnicodeMapping: _unboundedUnicodeString, unboundedUnicodeMapping: _unboundedUnicodeString, keyUnicodeMapping: _keyUnicodeString, createBoundedUnicodeMapping: size => new SqlServerStringTypeMapping( "nvarchar(" + size + ")", dbType: null, unicode: true, size: size)); }
public MySqlTypeMapper() { _simpleNameMappings = new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase) { // boolean { "bit", _bit }, // integers { "tinyint", _tinyint }, { "tinyint unsigned", _utinyint }, { "smallint", _smallint }, { "smallint unsigned", _usmallint }, { "mediumint", _int }, { "mediumint unsigned", _uint }, { "int", _int }, { "int unsigned", _uint }, { "bigint", _bigint }, { "bigint unsigned", _ubigint }, // decimals { "decimal", _decimal }, { "double", _double }, { "float", _float }, // binary { "binary", _binary }, { "varbinary", _varbinary }, { "tinyblob", _varbinarymax }, { "blob", _varbinarymax }, { "mediumblob", _varbinarymax }, { "longblob", _varbinarymax }, // string { "char", _char }, { "varchar", _varchar }, { "tinytext", _varcharmax }, { "text", _varcharmax }, { "mediumtext", _varcharmax }, { "longtext", _varcharmax }, // DateTime { "datetime", _dateTime6 }, { "time", _time6 }, // json { "json", _json }, // guid { "char(36)", _uniqueidentifier } }; _simpleMappings = new Dictionary <Type, RelationalTypeMapping> { // boolean { typeof(bool), _bit }, // integers { typeof(short), _smallint }, { typeof(ushort), _usmallint }, { typeof(int), _int }, { typeof(uint), _uint }, { typeof(long), _bigint }, { typeof(ulong), _ubigint }, // decimals { typeof(decimal), _decimal }, { typeof(float), _float }, { typeof(double), _double }, // byte / char { typeof(sbyte), _tinyint }, { typeof(byte), _utinyint }, { typeof(char), _utinyint }, // DateTime { typeof(DateTime), _dateTime6 }, { typeof(DateTimeOffset), _dateTimeOffset6 }, { typeof(TimeSpan), _time6 }, // json { typeof(JsonObject <>), _json }, // guid { typeof(Guid), _uniqueidentifier } }; ByteArrayMapper = new ByteArrayRelationalTypeMapper( 8000, _varbinarymax, _varbinarymax, _varbinary767, _rowversion, size => new MySqlMaxLengthMapping( "varbinary(" + size + ")", typeof(byte[]), DbType.Binary, unicode: false, size: size, hasNonDefaultUnicode: false, hasNonDefaultSize: true)); StringMapper = new StringRelationalTypeMapper( 8000, _varcharmax, _varcharmax, _varchar127, size => new MySqlMaxLengthMapping( "varchar(" + size + ")", typeof(string), dbType: DbType.AnsiString, unicode: false, size: size, hasNonDefaultUnicode: true, hasNonDefaultSize: true), 8000, _varcharmax, _varcharmax, _varchar127, size => new MySqlMaxLengthMapping( "varchar(" + size + ")", typeof(string), dbType: null, unicode: true, size: size, hasNonDefaultUnicode: false, hasNonDefaultSize: true)); }
public MySqlTypeMapper() { _simpleNameMappings = new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase) { { "bigint", _bigint }, //{ "binary varying", _varbinary }, { "binary", _varbinary }, { "bit", _bit }, { "char varying", _varchar }, { "char varying(8000)", _varcharmax }, { "char", _char }, { "character varying", _varchar }, { "character varying(8000)", _varcharmax }, { "character", _char }, { "date", _datetime }, { "datetime", _datetime }, { "dec", _decimal }, { "decimal", _decimal }, { "double", _double }, { "float", _float }, { "image", _varbinary }, { "int", _int }, { "money", _decimal }, { "nchar", _nchar }, { "ntext", _nvarchar }, { "numeric", _decimal }, { "nvarchar", _nvarchar }, { "smallint", _smallint }, { "smallmoney", _decimal }, { "text", _varchar }, { "time", _time }, { "tinyint", _tinyint }, { "uniqueidentifier", _uniqueidentifier }, { "varbinary", _varbinary }, { "varchar", _varchar }, { "varchar(8000)", _varcharmax }, { "json", _json } }; _simpleMappings = new Dictionary <Type, RelationalTypeMapping> { { typeof(int), _int }, { typeof(long), _bigint }, { typeof(DateTime), _datetime }, { typeof(DateTimeOffset), _datetimeoffset }, { typeof(Guid), _uniqueidentifier }, { typeof(bool), _bit }, { typeof(byte), _tinyint }, { typeof(double), _double }, { typeof(char), _int }, { typeof(sbyte), new RelationalTypeMapping("tinyint", typeof(sbyte)) }, { typeof(ushort), new RelationalTypeMapping("int", typeof(ushort)) }, { typeof(uint), new RelationalTypeMapping("bigint", typeof(uint)) }, { typeof(ulong), new RelationalTypeMapping("real(20, 0)", typeof(ulong)) }, { typeof(short), _smallint }, { typeof(float), _float }, { typeof(decimal), _decimal }, { typeof(TimeSpan), _time }, { typeof(JsonObject <>), _json } }; ByteArrayMapper = new ByteArrayRelationalTypeMapper( 8000, _varbinarymax, _varbinary767, _varbinary767, _rowversion, size => new MySqlMaxLengthMapping( "varbinary(" + size + ")", typeof(byte[]), DbType.Binary, unicode: false, size: size, hasNonDefaultUnicode: false, hasNonDefaultSize: true)); StringMapper = new StringRelationalTypeMapper( 8000, _varcharmax, _varchar255, _varchar255, size => new MySqlMaxLengthMapping( "varchar(" + size + ")", typeof(string), dbType: DbType.AnsiString, unicode: false, size: size, hasNonDefaultUnicode: true, hasNonDefaultSize: true), 8000, _varcharmax, _varchar255, _varchar255, size => new MySqlMaxLengthMapping( "varchar(" + size + ")", typeof(string), dbType: null, unicode: true, size: size, hasNonDefaultUnicode: false, hasNonDefaultSize: true)); }
public MySqlTypeMapper([NotNull] RelationalTypeMapperDependencies dependencies) : base(dependencies) { _storeTypeMappings = new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase) { // boolean { "bit", _bit }, // integers { "tinyint", _tinyint }, { "tinyint unsigned", _utinyint }, { "smallint", _smallint }, { "smallint unsigned", _usmallint }, { "mediumint", _int }, { "mediumint unsigned", _uint }, { "int", _int }, { "int unsigned", _uint }, { "bigint", _bigint }, { "bigint unsigned", _ubigint }, // decimals { "decimal", _decimal }, { "double", _double }, { "float", _float }, // binary { "binary", _binary }, { "varbinary", _varbinary }, { "tinyblob", _varbinarymax }, { "blob", _varbinarymax }, { "mediumblob", _varbinarymax }, { "longblob", _varbinarymax }, // string { "char", _char }, { "varchar", _varchar }, { "tinytext", _varcharmax }, { "text", _varcharmax }, { "mediumtext", _varcharmax }, { "longtext", _varcharmax }, // DateTime { "datetime", _dateTime6 }, { "time", _time6 }, // json { "json", _json }, // guid { "char(36)", _uniqueidentifier } }; _clrTypeMappings = new Dictionary <Type, RelationalTypeMapping> { // boolean { typeof(bool), _bit }, // integers { typeof(short), _smallint }, { typeof(ushort), _usmallint }, { typeof(int), _int }, { typeof(uint), _uint }, { typeof(long), _bigint }, { typeof(ulong), _ubigint }, // decimals { typeof(decimal), _decimal }, { typeof(float), _float }, { typeof(double), _double }, // byte / char { typeof(sbyte), _tinyint }, { typeof(byte), _utinyint }, { typeof(char), _utinyint }, // DateTime { typeof(DateTime), _dateTime6 }, { typeof(DateTimeOffset), _dateTimeOffset6 }, { typeof(TimeSpan), _time6 }, // json { typeof(JsonObject <>), _json }, // guid { typeof(Guid), _uniqueidentifier } }; _disallowedMappings = new HashSet <string>(StringComparer.OrdinalIgnoreCase) { "binary", "char", "varbinary", "varchar" }; ByteArrayMapper = new ByteArrayRelationalTypeMapper( 8000, _varbinarymax, _varbinarymax, _varbinary767, _rowversion, size => new MySqlByteArrayTypeMapping( "varbinary(" + size + ")", DbType.Binary, size)); StringMapper = new StringRelationalTypeMapper( maxBoundedAnsiLength: 8000, defaultAnsiMapping: _varcharmax, unboundedAnsiMapping: _varcharmax, keyAnsiMapping: _varchar127, createBoundedAnsiMapping: size => new MySqlStringTypeMapping( "varchar(" + size + ")", DbType.AnsiString, unicode: false, size: size), maxBoundedUnicodeLength: 8000, defaultUnicodeMapping: _varcharmax, unboundedUnicodeMapping: _varcharmax, keyUnicodeMapping: _varchar127, createBoundedUnicodeMapping: size => new MySqlStringTypeMapping( "varchar(" + size + ")", DbType.AnsiString, unicode: false, size: size)); }
public OracleTypeMapper([NotNull] RelationalTypeMapperDependencies dependencies) : base(dependencies) { _storeTypeMappings = new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase) { { "number(19)", _long }, { "blob", _variableLengthBinary }, { "raw", _fixedLengthBinary }, { "number(1)", _bool }, { "char", _fixedLengthAnsiString }, { "date", _date }, { "timestamp", _datetime }, { "timestamp with time zone", _datetimeoffset }, { "decimal(29,4)", _decimal }, { "float(49)", _double }, { "number(10)", _int }, { "nchar", _fixedLengthUnicodeString }, { "nvarchar2", _variableLengthUnicodeString }, { "number(6)", _short }, { "interval", _time }, { "number(3)", _byte }, { "raw(16)", _uniqueidentifier }, { "varchar2", _variableLengthAnsiString }, { "xml", _xml } }; _clrTypeMappings = new Dictionary <Type, RelationalTypeMapping> { { typeof(int), _int }, { typeof(long), _long }, { typeof(DateTime), _datetime }, { typeof(Guid), _uniqueidentifier }, { typeof(bool), _bool }, { typeof(byte), _byte }, { typeof(double), _double }, { typeof(DateTimeOffset), _datetimeoffset }, { typeof(short), _short }, { typeof(float), _real }, { typeof(decimal), _decimal }, { typeof(TimeSpan), _time } }; // These are disallowed only if specified without any kind of length specified in parenthesis. // This is because we don't try to make a new type from this string and any max length value // specified in the model, which means use of these strings is almost certainly an error, and // if it is not an error, then using, for example, varbinary(1) will work instead. _disallowedMappings = new HashSet <string>(StringComparer.OrdinalIgnoreCase) { "binary varying", "binary", "char varying", "char", "character varying", "character", "national char varying", "national character varying", "national character", "nchar", "nvarchar2", "varbinary", "varchar2" }; ByteArrayMapper = new ByteArrayRelationalTypeMapper( maxBoundedLength: 8000, defaultMapping: _unboundedBinary, unboundedMapping: _unboundedBinary, keyMapping: _keyBinary, rowVersionMapping: null, createBoundedMapping: size => new OracleByteArrayTypeMapping( "varbinary(" + size + ")", DbType.Binary, size)); StringMapper = new StringRelationalTypeMapper( maxBoundedAnsiLength: 4000, defaultAnsiMapping: _unboundedAnsiString, unboundedAnsiMapping: _unboundedAnsiString, keyAnsiMapping: _keyAnsiString, createBoundedAnsiMapping: size => new OracleStringTypeMapping( "VARCHAR2(" + size + ")", DbType.AnsiString, unicode: false, size: size), maxBoundedUnicodeLength: 2000, defaultUnicodeMapping: _unboundedUnicodeString, unboundedUnicodeMapping: _unboundedUnicodeString, keyUnicodeMapping: _keyUnicodeString, createBoundedUnicodeMapping: size => new OracleStringTypeMapping( "NVARCHAR2(" + size + ")", dbType: null, unicode: true, size: size)); }
public SqlCeTypeMapper([NotNull] RelationalTypeMapperDependencies dependencies) : base(dependencies) { _storeTypeMappings = new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase) { { "bigint", _bigint }, { "binary varying", _varbinary }, { "binary", _varbinary }, { "bit", _bit }, { "datetime", _datetime }, { "dec", _decimal }, { "decimal", _decimal }, { "float", _double }, { "image", _varbinary }, { "int", _int }, { "money", _decimal }, { "national char varying", _nvarchar }, { "national character varying", _nvarchar }, { "national character", _nchar }, { "nchar", _nchar }, { "ntext", _nvarcharmax }, { "numeric", _decimal }, { "nvarchar", _nvarchar }, { "real", _real }, { "rowversion", _rowversion }, { "smalldatetime", _datetime }, { "smallint", _smallint }, { "smallmoney", _decimal }, { "timestamp", _rowversion }, { "tinyint", _tinyint }, { "uniqueidentifier", _uniqueidentifier }, { "varbinary", _varbinary } }; _clrTypeMappings = new Dictionary <Type, RelationalTypeMapping> { { typeof(int), _int }, { typeof(long), _bigint }, { typeof(DateTime), _datetime }, { typeof(Guid), _uniqueidentifier }, { typeof(bool), _bit }, { typeof(byte), _tinyint }, { typeof(double), _double }, { typeof(char), _int }, { typeof(short), _smallint }, { typeof(float), _real }, { typeof(decimal), _decimal } }; _disallowedMappings = new HashSet <string>(StringComparer.OrdinalIgnoreCase) { "binary varying", "binary", "national char varying", "national character varying", "national character", "nchar", "nvarchar", "varbinary", }; ByteArrayMapper = new ByteArrayRelationalTypeMapper( 8000, _varbinary, _varbinarymax, _varbinary512, _rowversion, size => new SqlCeMaxLengthMapping( "varbinary(" + size + ")", typeof(byte[]), DbType.Binary, unicode: false, size: size, hasNonDefaultSize: true)); StringMapper = new StringRelationalTypeMapper( 4000, _nvarchar4000, _nvarcharmax, _nvarchar256, size => new SqlCeMaxLengthMapping( "nvarchar(" + size + ")", typeof(string), dbType: null, unicode: true, size: size, hasNonDefaultSize: true), 4000, _nvarchar4000, _nvarcharmax, _nvarchar256, size => new SqlCeMaxLengthMapping( "nvarchar(" + size + ")", typeof(string), dbType: null, unicode: true, size: size, hasNonDefaultSize: true)); }
public SqlCeTypeMapper([NotNull] RelationalTypeMapperDependencies dependencies) : base(dependencies) { _storeTypeMappings = new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase) { { "bigint", _bigint }, { "binary varying", _varbinary }, { "binary", _varbinary }, { "bit", _bit }, { "datetime", _datetime }, { "dec", _decimal }, { "decimal", _decimal }, { "float", _double }, { "image", _varbinarymax }, { "int", _int }, { "money", _decimal }, { "national char varying", _nvarchar }, { "national character varying", _nvarchar }, { "national character", _nchar }, { "nchar", _nchar }, { "ntext", _nvarcharmax }, { "numeric", _decimal }, { "nvarchar", _nvarchar }, { "real", _real }, { "rowversion", _rowversion }, { "smalldatetime", _datetime }, { "smallint", _smallint }, { "smallmoney", _decimal }, { "timestamp", _rowversion }, { "tinyint", _tinyint }, { "uniqueidentifier", _uniqueidentifier }, { "varbinary", _varbinary } }; _clrTypeMappings = new Dictionary <Type, RelationalTypeMapping> { { typeof(int), _int }, { typeof(long), _bigint }, { typeof(DateTime), _datetime }, { typeof(Guid), _uniqueidentifier }, { typeof(bool), _bit }, { typeof(byte), _tinyint }, { typeof(double), _double }, { typeof(short), _smallint }, { typeof(float), _real }, { typeof(decimal), _decimal } }; _disallowedMappings = new HashSet <string>(StringComparer.OrdinalIgnoreCase) { "binary varying", "binary", "national char varying", "national character varying", "national character", "nchar", "nvarchar", "varbinary", }; ByteArrayMapper = new ByteArrayRelationalTypeMapper( maxBoundedLength: 8000, defaultMapping: _varbinary, unboundedMapping: _varbinarymax, keyMapping: _varbinary512, rowVersionMapping: _rowversion, createBoundedMapping: size => new SqlCeByteArrayTypeMapping( "varbinary(" + size + ")", DbType.Binary, size: size)); StringMapper = new StringRelationalTypeMapper( maxBoundedAnsiLength: 8000, defaultAnsiMapping: _nvarchar4000, unboundedAnsiMapping: _nvarcharmax, keyAnsiMapping: _nvarchar256, createBoundedAnsiMapping: size => new SqlCeStringTypeMapping( "nvarchar(" + size + ")", dbType: null, size: size), maxBoundedUnicodeLength: 4000, defaultUnicodeMapping: _nvarchar4000, unboundedUnicodeMapping: _nvarcharmax, keyUnicodeMapping: _nvarchar256, createBoundedUnicodeMapping: size => new SqlCeStringTypeMapping( "nvarchar(" + size + ")", dbType: null, size: size)); }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public SqlServerTypeMapper() { _storeTypeMappings = new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase) { { "bigint", _bigint }, { "binary varying", _varbinary }, { "binary", _binary }, { "bit", _bit }, { "char varying", _varchar }, { "char", _char }, { "character varying", _varchar }, { "character", _char }, { "date", _date }, { "datetime", _datetime }, { "datetime2", _datetime2 }, { "datetimeoffset", _datetimeoffset }, { "dec", _decimal }, { "decimal", _decimal }, { "float", _double }, { "image", _varbinary }, { "int", _int }, { "money", _decimal }, { "national char varying", _nvarchar }, { "national character varying", _nvarchar }, { "national character", _nchar }, { "nchar", _nchar }, { "ntext", _nvarchar }, { "numeric", _decimal }, { "nvarchar", _nvarchar }, { "real", _real }, { "rowversion", _rowversion }, { "smalldatetime", _datetime }, { "smallint", _smallint }, { "smallmoney", _decimal }, { "text", _varchar }, { "time", _time }, { "timestamp", _rowversion }, { "tinyint", _tinyint }, { "uniqueidentifier", _uniqueidentifier }, { "varbinary", _varbinary }, { "varchar", _varchar }, { "xml", _xml } }; _clrTypeMappings = new Dictionary <Type, RelationalTypeMapping> { { typeof(int), _int }, { typeof(long), _bigint }, { typeof(DateTime), _datetime2 }, { typeof(Guid), _uniqueidentifier }, { typeof(bool), _bit }, { typeof(byte), _tinyint }, { typeof(double), _double }, { typeof(DateTimeOffset), _datetimeoffset }, { typeof(char), _int }, { typeof(short), _smallint }, { typeof(float), _real }, { typeof(decimal), _decimal }, { typeof(TimeSpan), _time } }; // These are disallowed only if specified without any kind of length specified in parenthesis. // This is because we don't try to make a new type from this string and any max length value // specified in the model, which means use of these strings is almost certainly an error, and // if it is not an error, then using, for example, varbinary(1) will work instead. _disallowedMappings = new HashSet <string>(StringComparer.OrdinalIgnoreCase) { "binary varying", "binary", "char varying", "char", "character varying", "character", "national char varying", "national character varying", "national character", "nchar", "nvarchar", "varbinary", "varchar" }; ByteArrayMapper = new ByteArrayRelationalTypeMapper( 8000, _varbinarymax, _varbinarymax, _varbinary900, _rowversion, size => new SqlServerMaxLengthMapping( "varbinary(" + size + ")", typeof(byte[]), DbType.Binary, unicode: false, size: size, hasNonDefaultUnicode: false, hasNonDefaultSize: true)); StringMapper = new StringRelationalTypeMapper( 8000, _varcharmax, _varcharmax, _varchar900, size => new SqlServerMaxLengthMapping( "varchar(" + size + ")", typeof(string), dbType: DbType.AnsiString, unicode: false, size: size, hasNonDefaultUnicode: true, hasNonDefaultSize: true), 4000, _nvarcharmax, _nvarcharmax, _nvarchar450, size => new SqlServerMaxLengthMapping( "nvarchar(" + size + ")", typeof(string), dbType: null, unicode: true, size: size, hasNonDefaultUnicode: false, hasNonDefaultSize: true)); }
public FbTypeMapper(RelationalTypeMapperDependencies dependencies) : base(dependencies) { _storeTypeMappings = new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase) { { "BOOLEAN", _boolean }, { "SMALLINT", _smallint }, { "INTEGER", _integer }, { "BIGINT", _bigint }, { "CHAR", _char }, { "VARCHAR", _varchar }, { "BLOB SUB_TYPE TEXT", _clob }, { "BLOB SUB_TYPE BINARY", _binary }, { "FLOAT", _float }, { "DOUBLE PRECISION", _double }, { "DECIMAL", _decimal }, { "TIMESTAMP", _timeStamp }, { "DATE", _date }, { "TIME", _time }, { "CHAR(16) CHARACTER SET OCTETS", _guid }, }; _clrTypeMappings = new Dictionary <Type, RelationalTypeMapping>() { { typeof(bool), _boolean }, { typeof(short), _smallint }, { typeof(int), _integer }, { typeof(long), _bigint }, { typeof(float), _float }, { typeof(double), _double }, { typeof(decimal), _decimal }, { typeof(byte[]), _binary }, { typeof(DateTime), _timeStamp }, { typeof(TimeSpan), _time }, { typeof(Guid), _guid } }; _disallowedMappings = new HashSet <string>(StringComparer.OrdinalIgnoreCase) { "CHARACTER", "CHAR", "VARCHAR", "CHARACTER VARYING", "CHAR VARYING", }; ByteArrayMapper = new ByteArrayRelationalTypeMapper( maxBoundedLength: BinaryMaxSize, defaultMapping: _binary, unboundedMapping: _binary, keyMapping: _binary, rowVersionMapping: null, createBoundedMapping: _ => _binary); StringMapper = new StringRelationalTypeMapper( maxBoundedAnsiLength: VarcharMaxSize, defaultAnsiMapping: _varcharMax, unboundedAnsiMapping: _varcharMax, keyAnsiMapping: _varchar256, createBoundedAnsiMapping: size => new FbStringTypeMapping($"VARCHAR({size})", FbDbType.VarChar, size), maxBoundedUnicodeLength: NVarcharMaxSize, defaultUnicodeMapping: _nvarcharMax, unboundedUnicodeMapping: _nvarcharMax, keyUnicodeMapping: _nvarchar256, createBoundedUnicodeMapping: size => new FbStringTypeMapping($"VARCHAR({size})", FbDbType.VarChar, size)); }
public MySQLTypeMapper() : base() { _storeTypeMappings = new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase) { { "bigint", _bigint }, { "decimal", _decimal }, { "double", _double }, { "float", _float }, { "int", _int }, { "mediumint", _int }, { "real", _real }, { "smallint", _smallint }, { "tinyint", _tinyint }, { "char", _char }, { "varchar", _varchar }, { "tinytext", _tinyText }, { "text", _text }, { "mediumtext", _mediumText }, { "longtext", _longText }, { "datetime", _datetime }, { "datetimeoffset", _datetimeoffset }, { "date", _date }, { "time", _time }, { "timestamp", _datetime }, { "year", _smallint }, { "bit", _bit }, { "string", _varchar }, { "tinyblob", _tinyblob }, { "blob", _blob }, { "mediumblob", _mediumblob }, { "longblob", _longblob }, { "binary", _binary }, { "varbinary", _varbinary }, { "enum", _enum }, { "set", _set }, { "json", _varchar } }; _clrTypeMappings = new Dictionary <Type, RelationalTypeMapping> { { typeof(int), _int }, { typeof(long), _bigint }, { typeof(DateTime), _datetime }, { typeof(DateTimeOffset), _datetimeoffset }, { typeof(bool), _bit }, { typeof(byte), _tinyint }, { typeof(float), _float }, { typeof(double), _double }, { typeof(char), _int }, { typeof(sbyte), _smallint }, { typeof(ushort), _int }, { typeof(uint), _bigint }, { typeof(ulong), new MySQLNumberTypeMapping("numeric(20, 0)", _decimal.GetType()) }, { typeof(short), _smallint }, { typeof(decimal), _decimal }, { typeof(byte[]), _varbinary }, { typeof(TimeSpan), _time } }; StringMapper = new StringRelationalTypeMapper( _textMaxLength, _text, _longText, _varcharkey, size => new MySQLStringTypeMapping( "varchar(" + size + ")", dbType: DbType.AnsiString, unicode: false, size: size, hasNonDefaultUnicode: true), _textMaxLength, _text, _longText, _varcharkey, size => new MySQLStringTypeMapping( "varchar(" + size + ")", dbType: null, unicode: true, size: size, hasNonDefaultUnicode: false)); ByteArrayMapper = new ByteArrayRelationalTypeMapper( _longTextMaxLength, _varbinary, _varbinary, _varbinary, _rowversion, _ => _varbinary); }
public MyCatTypeMapper() { _simpleNameMappings = new Dictionary<string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase) { { "bigint", _bigint }, //{ "binary varying", _varbinary }, { "binary", _varbinary }, { "bit", _bit }, { "char varying", _varchar }, { "char varying(8000)", _varcharmax }, { "char", _char }, { "character varying", _varchar }, { "character varying(8000)", _varcharmax }, { "character", _char }, { "date", _datetime }, { "datetime", _datetime }, { "dec", _decimal }, { "decimal", _decimal }, { "double", _double }, { "float", _float }, { "image", _varbinary }, { "int", _int }, { "money", _decimal }, { "nchar", _nchar }, { "ntext", _nvarchar }, { "numeric", _decimal }, { "nvarchar", _nvarchar }, { "smallint", _smallint }, { "smallmoney", _decimal }, { "text", _varchar }, { "time", _time }, { "tinyint", _tinyint }, { "uniqueidentifier", _uniqueidentifier }, { "varbinary", _varbinary }, { "varchar", _varchar }, { "varchar(8000)", _varcharmax }, { "json", _json } }; _simpleMappings = new Dictionary<Type, RelationalTypeMapping> { { typeof(int), _int }, { typeof(long), _bigint }, { typeof(DateTime), _datetime }, { typeof(DateTimeOffset), _datetimeoffset }, { typeof(Guid), _uniqueidentifier }, { typeof(bool), _bit }, { typeof(byte), _tinyint }, { typeof(double), _double }, { typeof(char), _int }, { typeof(sbyte), new RelationalTypeMapping("tinyint", typeof(sbyte)) }, { typeof(ushort), new RelationalTypeMapping("int", typeof(ushort)) }, { typeof(uint), new RelationalTypeMapping("bigint", typeof(uint)) }, { typeof(ulong), new RelationalTypeMapping("real(20, 0)", typeof(ulong)) }, { typeof(short), _smallint }, { typeof(float), _float }, { typeof(decimal), _decimal }, { typeof(TimeSpan), _time }, { typeof(JsonObject<>), _json } }; ByteArrayMapper = new ByteArrayRelationalTypeMapper( 8000, _varbinarymax, _varbinarymax, _varbinary255, _rowversion, size => new MyCatMaxLengthMapping( "varbinary(" + size + ")", typeof(byte[]), DbType.Binary, unicode: false, size: size, hasNonDefaultUnicode: false, hasNonDefaultSize: true)); StringMapper = new StringRelationalTypeMapper( 767, _varcharmax, _varcharmax, _varchar255, size => new MyCatMaxLengthMapping( "varchar(" + size + ")", typeof(string), dbType: DbType.AnsiString, unicode: false, size: size, hasNonDefaultUnicode: true, hasNonDefaultSize: true), 767, _varcharmax, _varcharmax, _varchar255, size => new MyCatMaxLengthMapping( "varchar(" + size + ")", typeof(string), dbType: null, unicode: true, size: size, hasNonDefaultUnicode: false, hasNonDefaultSize: true)); }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public SqlServerTypeMapper() { _storeTypeMappings = new Dictionary<string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase) { { "bigint", _bigint }, { "binary varying", _varbinary }, { "binary", _binary }, { "bit", _bit }, { "char varying", _varchar }, { "char", _char }, { "character varying", _varchar }, { "character", _char }, { "date", _date }, { "datetime", _datetime }, { "datetime2", _datetime2 }, { "datetimeoffset", _datetimeoffset }, { "dec", _decimal }, { "decimal", _decimal }, { "float", _double }, { "image", _varbinary }, { "int", _int }, { "money", _decimal }, { "national char varying", _nvarchar }, { "national character varying", _nvarchar }, { "national character", _nchar }, { "nchar", _nchar }, { "ntext", _nvarchar }, { "numeric", _decimal }, { "nvarchar", _nvarchar }, { "real", _real }, { "rowversion", _rowversion }, { "smalldatetime", _datetime }, { "smallint", _smallint }, { "smallmoney", _decimal }, { "text", _varchar }, { "time", _time }, { "timestamp", _rowversion }, { "tinyint", _tinyint }, { "uniqueidentifier", _uniqueidentifier }, { "varbinary", _varbinary }, { "varchar", _varchar }, { "xml", _xml } }; _clrTypeMappings = new Dictionary<Type, RelationalTypeMapping> { { typeof(int), _int }, { typeof(long), _bigint }, { typeof(DateTime), _datetime2 }, { typeof(Guid), _uniqueidentifier }, { typeof(bool), _bit }, { typeof(byte), _tinyint }, { typeof(double), _double }, { typeof(DateTimeOffset), _datetimeoffset }, { typeof(char), _int }, { typeof(short), _smallint }, { typeof(float), _real }, { typeof(decimal), _decimal }, { typeof(TimeSpan), _time } }; // These are disallowed only if specified without any kind of length specified in parenthesis. // This is because we don't try to make a new type from this string and any max length value // specified in the model, which means use of these strings is almost certainly an error, and // if it is not an error, then using, for example, varbinary(1) will work instead. _disallowedMappings = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "binary varying", "binary", "char varying", "char", "character varying", "character", "national char varying", "national character varying", "national character", "nchar", "nvarchar", "varbinary", "varchar" }; ByteArrayMapper = new ByteArrayRelationalTypeMapper( 8000, _varbinarymax, _varbinarymax, _varbinary900, _rowversion, size => new SqlServerMaxLengthMapping( "varbinary(" + size + ")", typeof(byte[]), DbType.Binary, unicode: false, size: size, hasNonDefaultUnicode: false, hasNonDefaultSize: true)); StringMapper = new StringRelationalTypeMapper( 8000, _varcharmax, _varcharmax, _varchar900, size => new SqlServerMaxLengthMapping( "varchar(" + size + ")", typeof(string), dbType: DbType.AnsiString, unicode: false, size: size, hasNonDefaultUnicode: true, hasNonDefaultSize: true), 4000, _nvarcharmax, _nvarcharmax, _nvarchar450, size => new SqlServerMaxLengthMapping( "nvarchar(" + size + ")", typeof(string), dbType: null, unicode: true, size: size, hasNonDefaultUnicode: false, hasNonDefaultSize: true)); }