public MySqlSmartTypeMapper( [NotNull] RelationalTypeMapperDependencies dependencies, [NotNull] IMySqlOptions options) : base(dependencies) { Check.NotNull(options, nameof(options)); _options = options; }
/// <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 FallbackRelationalCoreTypeMapper( [NotNull] CoreTypeMapperDependencies dependencies, [NotNull] RelationalTypeMapperDependencies relationalDependencies, [NotNull] IRelationalTypeMapper typeMapper) : base(dependencies, relationalDependencies) { _relationalTypeMapper = typeMapper; }
public SqlServerStringsTypeMapper( CoreTypeMapperDependencies coreDependencies, RelationalTypeMapperDependencies dependencies) : base(coreDependencies, dependencies) { _storeTypeMappings = new Dictionary <string, IList <RelationalTypeMapping> >(StringComparer.OrdinalIgnoreCase) { { "national char varying", new List <RelationalTypeMapping> { _variableLengthUnicodeString } }, { "national character varying", new List <RelationalTypeMapping> { _variableLengthUnicodeString } }, { "nvarchar", new List <RelationalTypeMapping> { _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 OracleTypeMapper( [NotNull] RelationalTypeMapperDependencies relationalDependencies) : base(relationalDependencies) { _clrTypeMappings = new Dictionary <Type, RelationalTypeMapping> { { typeof(int), _int }, { typeof(long), _long }, { typeof(DateTime), _datetime }, { typeof(byte), _byte }, { typeof(double), _double }, { typeof(bool), _bool }, { typeof(DateTimeOffset), _datetimeoffset }, { typeof(short), _short }, { typeof(float), _real }, { typeof(decimal), _decimal }, { typeof(TimeSpan), _time } }; _storeTypeMappings = new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase) { { "number(19)", _long }, { "blob", _variableLengthBinary }, { "raw", _fixedLengthBinary }, { "number(1)", _bool }, { "char", _fixedLengthAnsiString }, { "date", _date }, { "timestamp", _datetime }, { "timestamp(3) with time zone", _datetimeoffset3 }, { "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 }, { "varchar2", _variableLengthAnsiString }, { "clob", _unboundedUnicodeString }, { "xml", _xml }, { "number", _int } }; }
public SqlServerBytesTypeMapper( CoreTypeMapperDependencies coreDependencies, RelationalTypeMapperDependencies relationalDependencies) : base(coreDependencies, relationalDependencies) { _storeTypeMappings = new Dictionary <string, IList <RelationalTypeMapping> >(StringComparer.OrdinalIgnoreCase) { { "binary varying", new List <RelationalTypeMapping> { _variableLengthBinary } }, { "binary", new List <RelationalTypeMapping> { _fixedLengthBinary } }, { "image", new List <RelationalTypeMapping> { _variableLengthBinary } }, { "rowversion", new List <RelationalTypeMapping> { _rowversion } }, { "timestamp", new List <RelationalTypeMapping> { _rowversion } }, { "varbinary", new List <RelationalTypeMapping> { _variableLengthBinary } } }; _clrTypeMappings = new Dictionary <Type, RelationalTypeMapping>(); ByteArrayMapper = new ByteArrayRelationalTypeMapper( maxBoundedLength: 8000, defaultMapping: _unboundedBinary, unboundedMapping: _unboundedBinary, keyMapping: _keyBinary, rowVersionMapping: _rowversion, createBoundedMapping: size => new SqlServerByteArrayTypeMapping( "varbinary(" + size + ")", DbType.Binary, size)); }
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 FirebirdSqlTypeMapper([NotNull] RelationalTypeMapperDependencies dependencies) : base(dependencies) { _storeTypeMappings = new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase) { // boolean { "bit", _bit }, // integers { "smallint", _smallint }, { "integer", _int }, { "int64", _bigint }, // decimals { "decimal", _decimal }, { "double", _double }, { "float", _float }, { "decimal(18, 4)", _money }, // binary { "binary", _binary }, { "varbinary", _varbinary }, // string { "char", _char }, { "varchar", _varchar }, { "blob sub_type text", _text }, // DateTime { "timestamp", _dateTime }, { "date", _date }, // guid { "char(36)", _uniqueidentifier } }; _clrTypeMappings = new Dictionary <Type, RelationalTypeMapping> { // boolean { typeof(bool), _bit }, // integers { typeof(short), _smallint }, { typeof(int), _int }, { typeof(long), _bigint }, // decimals { typeof(decimal), _decimal }, { typeof(float), _float }, { typeof(double), _double }, // DateTime { typeof(DateTime), _dateTime }, { typeof(TimeSpan), _date }, // guid { typeof(Guid), _uniqueidentifier } }; _disallowedMappings = new HashSet <string>(StringComparer.OrdinalIgnoreCase) { "binary", "char", "varbinary", "varchar" }; StringMapper = new FirebirdSqlStringRelationalTypeMapper(); }
public FirebirdSqlTypeMapper([NotNull] RelationalTypeMapperDependencies dependencies) : base(dependencies) { _storeTypeMappings = new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase) { // boolean { "BIT", _bit }, // integers { "SMALLINT", _smallint }, { "INTEGER", _int }, { "BIGINT", _bigint }, // decimals { "DECIMAL(18, 2)", _decimal }, { "DOUBLE PRECICION", _double }, { "FLOAT", _float }, { "DECIMAL(18, 4)", _money }, // binary { "BINARY", _binary }, { "VARBINARY", _varbinary }, // string { "CHAR", _char }, { "VARCHAR", _varchar }, { "BLOB SUB_TYPE TEXT", _text }, // DateTime { "TIMESTAMP", _dateTime }, { "DATE", _date }, // guid { "CHAR(36)", _uniqueidentifier } }; _clrTypeMappings = new Dictionary <Type, RelationalTypeMapping> { // boolean { typeof(bool), _bit }, // integers { typeof(short), _smallint }, { typeof(int), _int }, { typeof(long), _bigint }, // decimals { typeof(decimal), _decimal }, { typeof(float), _float }, { typeof(double), _double }, // DateTime { typeof(DateTime), _dateTime }, { typeof(TimeSpan), _date }, // guid { typeof(Guid), _uniqueidentifier } }; _disallowedMappings = new HashSet <string>(StringComparer.OrdinalIgnoreCase) { "BINARY", "CHAR", "VARBINARY", "VARCHAR" }; StringMapper = new FirebirdSqlStringRelationalTypeMapper(); }
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 TestTypeMapper(RelationalTypeMapperDependencies dependencies) : base(dependencies) { }
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)); }
public CustomSqlServerTypeMapper(RelationalTypeMapperDependencies dependencies) : base(dependencies) { }
public TypeMapperWrapper([NotNull] RelationalTypeMapperDependencies dependencies) : base(dependencies) { }
/// <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", _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)); }
/// <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 ConcreteTypeMapper( CoreTypeMapperDependencies coreDependencies, RelationalTypeMapperDependencies dependencies) : base(coreDependencies, dependencies) { }
/// <summary> /// </summary> public SpannerTypeMapper(RelationalTypeMapperDependencies dependencies) : base(dependencies) { }
public ConcreteTypeMapper( RelationalTypeMapperDependencies dependencies) : base(dependencies) { }
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)); }