Ejemplo n.º 1
0
 public TypeMappingSource(
     TypeMappingSourceDependencies dependencies,
     RelationalTypeMappingSourceDependencies relationalDependencies,
     INpgsqlOptions npgsqlOptions = null) :
     base(dependencies, relationalDependencies, npgsqlOptions)
 {
 }
Ejemplo n.º 2
0
 public ReplacementTypeMappingSource(
     TypeMappingSourceDependencies dependencies,
     RelationalTypeMappingSourceDependencies relationalDependencies,
     IMySqlOptions options)
     : base(dependencies, relationalDependencies, options)
 {
 }
 public MySQLTypeMapper([NotNull] TypeMappingSourceDependencies dependencies,
                        [NotNull] RelationalTypeMappingSourceDependencies relationalDependencies,
                        IMySQLOptions options)
     : base(dependencies, relationalDependencies)
 {
     _options = options;
 }
Ejemplo n.º 4
0
 /// <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 SqlServerTypeMappingSource(
     [NotNull] TypeMappingSourceDependencies dependencies,
     [NotNull] RelationalTypeMappingSourceDependencies relationalDependencies,
     [NotNull] IRelationalTypeMapper typeMapper)
     : base(dependencies, relationalDependencies, typeMapper)
 {
 }
 public VfpTypeMappingSource(
     [NotNull] TypeMappingSourceDependencies dependencies,
     [NotNull] RelationalTypeMappingSourceDependencies relationalDependencies
     ) : base(dependencies, relationalDependencies)
 {
     _clrTypeMappings   = CreateClrMapMappings();
     _storeTypeMappings = CreateStoreTypeMappings();
 }
Ejemplo n.º 6
0
 /// <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 FallbackRelationalTypeMappingSource(
     [NotNull] TypeMappingSourceDependencies dependencies,
     [NotNull] RelationalTypeMappingSourceDependencies relationalDependencies,
     [NotNull] IRelationalTypeMapper typeMapper)
     : base(dependencies, relationalDependencies)
 {
     _relationalTypeMapper = typeMapper;
 }
Ejemplo n.º 7
0
 public ReplacementTypeMappingSource(
     TypeMappingSourceDependencies dependencies,
     RelationalTypeMappingSourceDependencies relationalDependencies,
     IMySqlOptions options,
     IMySqlConnectionInfo connectionInfo)
     : base(dependencies, relationalDependencies, options, connectionInfo)
 {
 }
Ejemplo n.º 8
0
 public MySqlTypeMappingSource(
     [NotNull] TypeMappingSourceDependencies dependencies,
     [NotNull] RelationalTypeMappingSourceDependencies relationalDependencies,
     [NotNull] IMySqlOptions options,
     [NotNull] IMySqlConnectionInfo connectionInfo)
     : base(dependencies, relationalDependencies)
 {
     _options        = options;
     _connectionInfo = connectionInfo;
 }
Ejemplo n.º 9
0
        /// <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 FallbackRelationalTypeMappingSource(
            [NotNull] TypeMappingSourceDependencies dependencies,
            [NotNull] RelationalTypeMappingSourceDependencies relationalDependencies,
#pragma warning disable 618
            [NotNull] IRelationalTypeMapper typeMapper)
#pragma warning restore 618
            : base(dependencies, relationalDependencies)
        {
            _relationalTypeMapper = typeMapper;
        }
        public SqlServerNodaTimeTypeMappingSource(
            [NotNull] TypeMappingSourceDependencies dependencies,
            [NotNull] RelationalTypeMappingSourceDependencies relationalDependencies)
            : base(dependencies, relationalDependencies)
        {
            this._sqlServerNodaTimeTypeMappingSourcePlugin = relationalDependencies.Plugins.OfType <SqlServerNodaTimeTypeMappingSourcePlugin>().FirstOrDefault();

            if (this._sqlServerNodaTimeTypeMappingSourcePlugin == null)
            {
                throw new NullReferenceException($"The '{nameof(SqlServerNodaTimeTypeMappingSourcePlugin)}' was not found. Please ensure that it is registered in the DI container.");
            }
        }
Ejemplo n.º 11
0
        /// <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 SqlCeTypeMappingSource(
            [NotNull] TypeMappingSourceDependencies dependencies,
            [NotNull] RelationalTypeMappingSourceDependencies relationalDependencies)
            : base(dependencies, relationalDependencies)
        {
            _clrTypeMappings
                = new Dictionary <Type, RelationalTypeMapping>
                {
                { typeof(int), _int },
                { typeof(long), _long },
                { typeof(Guid), _uniqueidentifier },
                { typeof(DateTime), _datetime },
                { typeof(bool), _bool },
                { typeof(byte), _byte },
                { typeof(double), _double },
                { typeof(short), _short },
                { typeof(float), _real },
                { typeof(decimal), _decimal },
                };

            _storeTypeMappings
                = new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase)
                {
                { "bigint", _long },
                { "binary varying", _variableLengthBinary },
                { "binary", _fixedLengthBinary },
                { "bit", _bool },
                { "datetime", _datetime },
                { "dec", _decimal },
                { "decimal", _decimal },
                { "double precision", _double },
                { "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 },
                { "smallint", _short },
                { "timestamp", _rowversion },
                { "tinyint", _byte },
                { "uniqueidentifier", _uniqueidentifier },
                { "varbinary", _variableLengthBinary }
                };
        }
        public FbTypeMappingSource(
            TypeMappingSourceDependencies dependencies,
            RelationalTypeMappingSourceDependencies relationalDependencies,
            IFbOptions options)
            : base(dependencies, relationalDependencies)
        {
            _isLegacy = options.IsLegacyDialect;
            _bigint   = new LongTypeMapping(
                _isLegacy
                    ? "INTEGER" : "BIGINT",
                DbType.Int64);

            _boolean = new FbBoolTypeMapping(
                _isLegacy
                    ? "SMALLINT" : "BOOLEAN");

            _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 },
                { "NUMERIC", _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 }
            };
        }
Ejemplo n.º 13
0
 public CustomNpgsqlTypeMappingSource(
     TypeMappingSourceDependencies dependencies,
     RelationalTypeMappingSourceDependencies relationalDependencies,
     ISqlGenerationHelper sqlGenerationHelper,
     INpgsqlOptions?npgsqlOptions = null)
     : base(dependencies, relationalDependencies, sqlGenerationHelper, npgsqlOptions)
 {
     StoreTypeMappings["inet"] =
         new RelationalTypeMapping[]
     {
         new NpgsqlInetWithMaskTypeMapping(),
         new NpgsqlInetTypeMapping()
     };
 }
Ejemplo n.º 14
0
        public FbTypeMappingSource(
            TypeMappingSourceDependencies dependencies,
            RelationalTypeMappingSourceDependencies relationalDependencies)
            : base(dependencies, relationalDependencies)
        {
            _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 },
                { "NUMERIC", _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",
            };
        }
 public SqlCeBytesTypeMappingSource(
     TypeMappingSourceDependencies dependencies,
     RelationalTypeMappingSourceDependencies relationalDependencies)
     : base(dependencies, relationalDependencies)
 {
     _storeTypeMappings
         = new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase)
         {
         { "binary varying", _variableLengthBinary },
         { "binary", _fixedLengthBinary },
         { "image", _variableLengthBinary },
         { "rowversion", _rowversion },
         { "varbinary", _variableLengthBinary }
         };
 }
Ejemplo n.º 16
0
 /// <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 SqlCeStringsTypeMappingSource(
     TypeMappingSourceDependencies dependencies,
     RelationalTypeMappingSourceDependencies relationalDependencies)
     : base(dependencies, relationalDependencies)
 {
     _storeTypeMappings
         = new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase)
         {
         { "national char varying", _variableLengthUnicodeString },
         { "national character varying", _variableLengthUnicodeString },
         { "national character", _fixedLengthUnicodeString },
         { "nchar", _fixedLengthUnicodeString },
         { "ntext", _variableLengthUnicodeString },
         { "nvarchar", _variableLengthUnicodeString },
         };
 }
Ejemplo n.º 17
0
        /// <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 OracleTypeMappingSource(
            [NotNull] TypeMappingSourceDependencies dependencies,
            [NotNull] RelationalTypeMappingSourceDependencies relationalDependencies)
            : base(dependencies, relationalDependencies)
        {
            _clrTypeMappings
                = new Dictionary <Type, RelationalTypeMapping>
                {
                { typeof(int), _int },
                { typeof(long), _long },
                { typeof(DateTime), _datetime },
                { typeof(byte), _byte },
                { typeof(double), _double },
                { 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 },
                { "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 }
                };
        }
Ejemplo n.º 18
0
        public OpenEdgeTypeMappingSource(TypeMappingSourceDependencies dependencies, RelationalTypeMappingSourceDependencies relationalDependencies)
            : base(dependencies, relationalDependencies)
        {
            _clrTypeMappings
                = new Dictionary <Type, RelationalTypeMapping>
                {
                { typeof(int), _integer },
                { typeof(long), _bigint },
                { typeof(DateTime), _datetime },
                { typeof(bool), _boolean },
                { typeof(byte), _tinyint },
                { typeof(byte[]), _binary },
                { typeof(double), _double },
                { typeof(DateTimeOffset), _datetime },
                { typeof(short), _smallint },
                { typeof(float), _float },
                { typeof(decimal), _decimal },
                { typeof(TimeSpan), _time }
                };

            _storeTypeMappings
                = new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase)
                {
                { "bigint", _bigint },
                { "int64", _bigint },
                { "binary varying", _binary },
                { "raw", _binary },
                { "binary", _binary },
                { "blob", _binary },
                { "bit", _boolean },
                { "logical", _boolean },
                { "char varying", _char },
                { "char", _char },
                { "character varying", _char },
                { "character", _char },
                { "clob", _char },
                { "date", _date },
                { "datetime", _datetime },
                { "datetime2", _datetime },
                { "datetimeoffset", _datetimeOffset },
                { "datetime-tz", _datetimeOffset },
                { "dec", _decimal },
                { "decimal", _decimal },
                { "double precision", _double },
                { "double", _double },
                { "float", _double },
                { "image", _binary },
                { "int", _integer },
                { "integer", _integer },
                { "money", _decimal },
                { "numeric", _decimal },
                { "real", _float },
                { "recid", _char },
                { "smalldatetime", _datetime },
                { "smallint", _smallint },
                { "short", _smallint },
                { "smallmoney", _decimal },
                { "text", _char },
                { "time", _time },
                { "timestamp", _timeStamp },
                { "tinyint", _tinyint },
                { "varbinary", _binary },
                { "varchar", _varchar }
                };
        }
Ejemplo n.º 19
0
 public TestRelationalTypeMappingSource(
     TypeMappingSourceDependencies dependencies,
     RelationalTypeMappingSourceDependencies relationalDependencies)
     : base(dependencies, relationalDependencies)
 {
 }
Ejemplo n.º 20
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public SqliteTypeMappingSource(
     [NotNull] TypeMappingSourceDependencies dependencies,
     [NotNull] RelationalTypeMappingSourceDependencies relationalDependencies)
     : base(dependencies, relationalDependencies)
 {
 }
        public SpannerTypeMappingSource(
            TypeMappingSourceDependencies dependencies,
            RelationalTypeMappingSourceDependencies relationalDependencies)
            : base(dependencies, relationalDependencies)
        {
            _clrTypeMappings
                = new Dictionary <System.Type, RelationalTypeMapping>
                {
                { typeof(short), s_short },
                { typeof(int), s_int },
                { typeof(long), s_long },
                { typeof(decimal), s_numeric },
                { typeof(SpannerNumeric), s_numeric },
                { typeof(uint), s_uint },
                { typeof(bool), s_bool },
                { typeof(SpannerDate), s_date },
                { typeof(DateTime), s_datetime },
                { typeof(float), s_float },
                { typeof(double), s_double },
                { typeof(string), s_defaultString },
                { typeof(char), s_char },
                { typeof(Guid), s_guid },
                { typeof(Regex), s_defaultString },
                { typeof(byte), s_byte },
                { typeof(sbyte), s_sbyte },
                { typeof(ulong), s_ulong },
                { typeof(ushort), s_ushort },
                { typeof(byte[]), s_bytes },

                { typeof(decimal[]), s_numericArray },
                { typeof(decimal?[]), s_nullableNumericArray },
                { typeof(SpannerNumeric[]), s_numericArray },
                { typeof(SpannerNumeric?[]), s_nullableNumericArray },
                { typeof(List <decimal>), s_numericList },
                { typeof(List <decimal?>), s_nullableNumericList },
                { typeof(List <SpannerNumeric>), s_numericList },
                { typeof(List <SpannerNumeric?>), s_nullableNumericList },
                { typeof(string[]), s_stringArray },
                { typeof(List <string>), s_stringList },
                { typeof(bool[]), s_boolArray },
                { typeof(bool?[]), s_nullableBoolArray },
                { typeof(List <bool>), s_boolList },
                { typeof(List <bool?>), s_nullableBoolList },
                { typeof(double[]), s_doubleArray },
                { typeof(double?[]), s_nullableDoubleArray },
                { typeof(List <double>), s_doubleList },
                { typeof(List <double?>), s_nullableDoubleList },
                { typeof(long[]), s_longArray },
                { typeof(long?[]), s_nullableLongArray },
                { typeof(List <long>), s_longList },
                { typeof(List <long?>), s_nullableLongList },
                { typeof(SpannerDate[]), s_dateArray },
                { typeof(SpannerDate?[]), s_nullableDateArray },
                { typeof(List <SpannerDate>), s_dateList },
                { typeof(List <SpannerDate?>), s_nullableDateList },
                { typeof(List <DateTime>), s_timestampList },
                { typeof(List <DateTime?>), s_nullableTimestampList },
                { typeof(DateTime[]), s_timestampArray },
                { typeof(DateTime?[]), s_nullableTimestampArray },
                { typeof(byte[][]), s_byteArray },
                { typeof(List <byte[]>), s_byteList },
                };

            _storeTypeMappings = new Dictionary <string, RelationalTypeMapping>
            {
                { SpannerDbType.Bool.ToString(), s_bool },
                { SpannerDbType.Bytes.ToString(), s_bytes },
                { SpannerDbType.Date.ToString(), s_date },
                { SpannerDbType.Float64.ToString(), s_double },
                { SpannerDbType.Int64.ToString(), s_long },
                { SpannerDbType.Timestamp.ToString(), s_datetime },
                { SpannerDbType.String.ToString(), s_defaultString },
                { SpannerDbType.Numeric.ToString(), s_numeric },
                { "ARRAY<BOOL>", s_nullableBoolList },
                { "ARRAY<BYTES", s_byteList },
                { "ARRAY<DATE>", s_nullableDateList },
                { "ARRAY<FLOAT64>", s_nullableDoubleList },
                { "ARRAY<INT64>", s_nullableLongList },
                { "ARRAY<STRING", s_stringList },
                { "ARRAY<TIMESTAMP>", s_nullableTimestampList },
                { "ARRAY<NUMERIC>", s_nullableNumericList }
            };

            _arrayTypeMappings = new Dictionary <string, RelationalTypeMapping>
            {
                { "ARRAY<BOOL>", s_nullableBoolArray },
                { "ARRAY<BYTES", s_byteArray },
                { "ARRAY<DATE>", s_nullableDateArray },
                { "ARRAY<FLOAT64>", s_nullableDoubleArray },
                { "ARRAY<INT64>", s_nullableLongArray },
                { "ARRAY<STRING", s_stringArray },
                { "ARRAY<TIMESTAMP>", s_nullableTimestampArray },
                { "ARRAY<NUMERIC>", s_nullableNumericArray }
            };
        }
Ejemplo n.º 22
0
        public MySqlTypeMappingSource(
            [NotNull] TypeMappingSourceDependencies dependencies,
            [NotNull] RelationalTypeMappingSourceDependencies relationalDependencies,
            [NotNull] IMySqlOptions options)
            : base(dependencies, relationalDependencies)
        {
            _options = options;

            _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 },
                { "dec", _decimal },
                { "fixed", _decimal },
                { "double", _double },
                { "double precision", _double },
                { "real", _double },
                { "float", _float },

                // binary
                { "binary", _binary },
                { "varbinary", _varbinary },
                { "tinyblob", _varbinary },
                { "blob", _varbinary },
                { "mediumblob", _varbinary },
                { "longblob", _varbinary },

                // string
                { "char", options.NoBackslashEscapes ? _char_noBackslashEscapes : _char },
                { "varchar", options.NoBackslashEscapes ? _varchar_noBackslashEscapes : _varchar },
                { "nchar", options.NoBackslashEscapes ? _nchar_noBackslashEscapes : _nchar },
                { "nvarchar", options.NoBackslashEscapes ? _nvarchar_noBackslashEscapes : _nvarchar },
                { "tinytext", options.NoBackslashEscapes ? _varcharmax_noBackslashEscapes : _varcharmax },
                { "text", options.NoBackslashEscapes ? _varcharmax_noBackslashEscapes : _varcharmax },
                { "mediumtext", options.NoBackslashEscapes ? _varcharmax_noBackslashEscapes : _varcharmax },
                { "longtext", options.NoBackslashEscapes ? _varcharmax_noBackslashEscapes : _varcharmax },
                { "enum", options.NoBackslashEscapes ? _enum_noBackkSlashEscapes : _enum },

                // DateTime
                { "date", _date }
                };

            _unicodeStoreTypeMappings = options.NoBackslashEscapes
                ? new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase)
            {
                { "char", _nchar_noBackslashEscapes },
                { "varchar", _nvarchar_noBackslashEscapes },
                { "nchar", _nchar_noBackslashEscapes },
                { "nvarchar", _nvarchar_noBackslashEscapes },
                { "tinytext", _nvarcharmax_noBackslashEscapes },
                { "text", _nvarcharmax_noBackslashEscapes },
                { "mediumtext", _nvarcharmax_noBackslashEscapes },
                { "longtext", _nvarcharmax_noBackslashEscapes },
                { "enum", _enum_noBackkSlashEscapes }
            }
                : new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase)
            {
                { "char", _nchar },
                { "varchar", _nvarchar },
                { "nchar", _nchar },
                { "nvarchar", _nvarchar },
                { "tinytext", _nvarcharmax },
                { "text", _nvarcharmax },
                { "mediumtext", _nvarcharmax },
                { "longtext", _nvarcharmax },
                { "enum", _enum }
            };

            _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 }
                };

            // guid
            _clrTypeMappings[typeof(Guid)] = _options.ConnectionSettings.OldGuids
                ? _oldGuid
                : _uniqueidentifier;

            // DateTime
            if (_options.ServerVersion.SupportsDateTime6)
            {
                _storeTypeMappings["time"]               = _time6;
                _clrTypeMappings[typeof(DateTime)]       = _dateTime6;
                _clrTypeMappings[typeof(DateTimeOffset)] = _dateTimeOffset6;
                _clrTypeMappings[typeof(TimeSpan)]       = _time6;
            }
            else
            {
                _storeTypeMappings["time"]               = _time;
                _clrTypeMappings[typeof(DateTime)]       = _dateTime;
                _clrTypeMappings[typeof(DateTimeOffset)] = _dateTimeOffset;
                _clrTypeMappings[typeof(TimeSpan)]       = _time;
            }
        }
Ejemplo n.º 23
0
        /// <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 JetTypeMappingSource(
            [NotNull] TypeMappingSourceDependencies dependencies,
            [NotNull] RelationalTypeMappingSourceDependencies relationalDependencies)
            : base(dependencies, relationalDependencies)
        {
            _storeTypeMappings
                = new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase)
                {
                { "binary", _fixedLengthBinary },
                { "bit", _bool },
                { "byte", _byte },
                { "char", _fixedLengthUnicodeString },
                { "date", _date },
                { "datetime", _datetime },
                { "decimal", _decimal },
                { "float", _double },
                { "double", _double },
                { "image", _variableLengthBinary },
                { "int", _int },
                { "guid", _uniqueidentifier },
                { "money", _decimal },
                { "numeric", _decimal },
                { "real", _real },
                { "single", _real },
                { "smalldatetime", _datetime },
                { "smallint", _short },
                { "smallmoney", _decimal },
                { "text", _variableLengthUnicodeString },
                { "time", _time },
                { "timestamp", _rowversion },
                { "tinyint", _byte },
                { "uniqueidentifier", _uniqueidentifier },
                { "varbinary", _variableLengthBinary },
                { "varchar", _variableLengthUnicodeString },
                { "xml", _xml }
                };

            // Note: sbyte, ushort, uint, char and ulong type mappings are not supported by Jet.
            // 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), _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",
                "nvarchar",
                "varbinary",
                "varchar"
                };
        }
        /// <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 AseTypeMappingSource(TypeMappingSourceDependencies dependencies, RelationalTypeMappingSourceDependencies relationalDependencies)
            : base(dependencies, relationalDependencies)
        {
            _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 }
                };

            _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 },
                { "double precision", _double },
                { "float", _double },
                { "image", _variableLengthBinary },
                { "int", _int },
                { "money", _money },
                { "national char varying", _variableLengthUnicodeString },
                { "national character varying", _variableLengthUnicodeString },
                { "national character", _fixedLengthUnicodeString },
                { "nchar", _fixedLengthUnicodeString },
                { "ntext", _variableLengthUnicodeString },
                { "numeric", _decimal },
                { "nvarchar", _variableLengthUnicodeString },
                { "nvarchar(max)", _variableLengthMaxUnicodeString },
                { "real", _real },
                { "rowversion", _rowversion },
                { "smalldatetime", _datetime },
                { "smallint", _short },
                { "smallmoney", _money },
                //{ "sql_variant", _sqlVariant },
                { "text", _variableLengthAnsiString },
                { "time", _time },
                { "timestamp", _rowversion },
                { "tinyint", _byte },
                { "uniqueidentifier", _uniqueidentifier },
                { "varbinary", _variableLengthBinary },
                { "varbinary(max)", _variableLengthMaxBinary },
                { "varchar", _variableLengthAnsiString },
                { "varchar(max)", _variableLengthMaxAnsiString },
                { "xml", _xml }
                };
        }
Ejemplo n.º 25
0
        /// <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 JetTypeMappingSource(
            [NotNull] TypeMappingSourceDependencies dependencies,
            [NotNull] RelationalTypeMappingSourceDependencies relationalDependencies)
            : base(dependencies, relationalDependencies)
        {
            // References:
            // https://docs.microsoft.com/en-us/previous-versions/office/developer/office2000/aa140015(v=office.10)
            // https://docs.microsoft.com/en-us/office/vba/access/concepts/error-codes/comparison-of-data-types
            // https://support.office.com/en-us/article/equivalent-ansi-sql-data-types-7a0a6bef-ef25-45f9-8a9a-3c5f21b5c65d
            // https://sourcedaddy.com/ms-access/sql-data-types.html

            // TODO: Check the types and their mappings against
            //       https://docs.microsoft.com/en-us/previous-versions/office/developer/office2000/aa140015(v=office.10)

            _storeTypeMappings
                = new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase)
                {
                { "binary", _fixedLengthBinary },

                { "varbinary", _variableLengthBinary },
                { "binary varying", _variableLengthBinary },
                { "bit varying", _variableLengthBinary },

                { "longbinary", _unboundedBinary },
                { "general", _unboundedBinary },
                { "image", _unboundedBinary },
                { "oleobject", _unboundedBinary },

                { "bit", _bit },
                { "boolean", _bit },
                { "logical", _bit },
                { "logical1", _bit },
                { "yesno", _bit },

                { "counter", _counter },
                { "identity", _counter },
                { "autoincrement", _counter },

                { "byte", _byte },
                { "tinyint", _byte },
                { "integer1", _byte },

                { "smallint", _smallint },
                { "short", _smallint },
                { "integer2", _smallint },

                { "integer", _integer },
                { "long", _integer },
                { "int", _integer },
                { "integer4", _integer },

                { "single", _single },
                { "real", _single },
                { "float4", _single },
                { "ieeesingle", _single },

                { "double", _double },
                { "float", _double },
                { "float8", _double },
                { "ieeedouble", _double },
                { "number", _double },

                { "decimal", _decimal },
                { "numeric", _decimal },
                { "dec", _decimal },

                { "currency", _currency },
                { "money", _currency },

                { "datetime", _datetime },
                { "date", _date },
                { "time", _time },

                { "char", _fixedLengthUnicodeString },
                { "alphanumeric", _fixedLengthUnicodeString },
                { "character", _fixedLengthUnicodeString },
                { "nchar", _fixedLengthUnicodeString },
                { "national char", _fixedLengthUnicodeString },
                { "national character", _fixedLengthUnicodeString },

                { "varchar", _variableLengthUnicodeString },
                { "string", _variableLengthUnicodeString },
                { "char varying", _variableLengthUnicodeString },
                { "character varying", _variableLengthUnicodeString },
                { "national char varying", _variableLengthUnicodeString },
                { "national character varying", _variableLengthUnicodeString },

                { "longchar", _unboundedUnicodeString },
                { "longtext", _unboundedUnicodeString },
                { "memo", _unboundedUnicodeString },
                { "note", _unboundedUnicodeString },
                { "ntext", _unboundedUnicodeString },

                { "guid", _guid },
                { "uniqueidentifier", _guid },

                { "timestamp", _rowversion },
                };

            // Note: sbyte, ushort, uint, char, long and ulong type mappings are not supported by Jet.
            // 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(bool), _bool },
                { typeof(byte), _byte },
                { typeof(sbyte), _smallint },
                { typeof(short), _smallint },
                { typeof(int), _integer },
                // {typeof(long), _bigint}, // uses DECIMAL(28,0)
                { typeof(float), _single },
                { typeof(double), _double },
                { typeof(decimal), _decimal },   // CHECK: Is this supported or do we need to use CURRENCY?
                { typeof(DateTime), _datetime },
                { typeof(DateTimeOffset), _datetimeoffset },
                { typeof(TimeSpan), _time },
                { typeof(Guid), _guid },
                };

            // 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",

                "varbinary",
                "image",
                "binary varying",
                "bit varying",

                "char",
                "alphanumeric",
                "character",
                "nchar",
                "national char",
                "national character",

                "varchar",
                "string",
                "char varying",
                "character varying",
                "national char varying",
                "national character varying",
                };
        }
Ejemplo n.º 26
0
 public NodaTimeSqlServerTypeMappingSource(TypeMappingSourceDependencies dependencies, RelationalTypeMappingSourceDependencies relationalDependencies)
     : base(dependencies, relationalDependencies)
 {
 }
 public JsonTypeMappingSource([NotNullAttribute] TypeMappingSourceDependencies dependencies, [NotNullAttribute] RelationalTypeMappingSourceDependencies relationalDependencies) : base(dependencies, relationalDependencies)
 {
 }
Ejemplo n.º 28
0
 public TypeMapperWrapper([NotNull] TypeMappingSourceDependencies dependencies,
                          [NotNull] RelationalTypeMappingSourceDependencies relationalDependencies)
     : base(dependencies, relationalDependencies)
 {
 }
Ejemplo n.º 29
0
 public RivenOracleTypeMappingSource([NotNull] TypeMappingSourceDependencies dependencies, [NotNull] RelationalTypeMappingSourceDependencies relationalDependencies, [NotNull] IOracleOptions oracleOptions)
     : base(dependencies, relationalDependencies, oracleOptions)
 {
 }
Ejemplo n.º 30
0
        public NpgsqlTypeMappingSource([NotNull] TypeMappingSourceDependencies dependencies,
                                       [NotNull] RelationalTypeMappingSourceDependencies relationalDependencies,
                                       [NotNull] ISqlGenerationHelper sqlGenerationHelper,
                                       [CanBeNull] INpgsqlOptions npgsqlOptions = null)
            : base(dependencies, relationalDependencies)
        {
            _sqlGenerationHelper = Check.NotNull(sqlGenerationHelper, nameof(sqlGenerationHelper));

            // Initialize some mappings which depend on other mappings
            _int4range = new NpgsqlRangeTypeMapping("int4range", typeof(NpgsqlRange <int>), _int4, sqlGenerationHelper);
            _int8range = new NpgsqlRangeTypeMapping("int8range", typeof(NpgsqlRange <long>), _int8, sqlGenerationHelper);
            _numrange  = new NpgsqlRangeTypeMapping("numrange", typeof(NpgsqlRange <decimal>), _numeric, sqlGenerationHelper);
            _tsrange   = new NpgsqlRangeTypeMapping("tsrange", typeof(NpgsqlRange <DateTime>), _timestamp, sqlGenerationHelper);
            _tstzrange = new NpgsqlRangeTypeMapping("tstzrange", typeof(NpgsqlRange <DateTime>), _timestamptz, sqlGenerationHelper);
            _daterange = new NpgsqlRangeTypeMapping("daterange", typeof(NpgsqlRange <DateTime>), _timestamptz, sqlGenerationHelper);

            // Note that PostgreSQL has aliases to some built-in type name aliases (e.g. int4 for integer),
            // these are mapped as well.
            // https://www.postgresql.org/docs/current/static/datatype.html#DATATYPE-TABLE
            var storeTypeMappings = new Dictionary <string, RelationalTypeMapping[]>(StringComparer.OrdinalIgnoreCase)
            {
                { "boolean", new[] { _bool } },
                { "bool", new[] { _bool } },
                { "bytea", new[] { _bytea } },
                { "real", new[] { _float4 } },
                { "float4", new[] { _float4 } },
                { "double precision", new[] { _float8 } },
                { "float8", new[] { _float8 } },
                { "numeric", new[] { _numeric } },
                { "decimal", new[] { _numeric } },
                { "money", new[] { _money } },
                { "uuid", new[] { _uuid } },
                { "smallint", new RelationalTypeMapping[] { _int2, _int2Byte } },
                { "int2", new RelationalTypeMapping[] { _int2, _int2Byte } },
                { "integer", new[] { _int4 } },
                { "int", new[] { _int4 } },
                { "int4", new[] { _int4 } },
                { "bigint", new[] { _int8 } },
                { "int8", new[] { _int8 } },
                { "text", new[] { _text } },
                { "jsonb", new RelationalTypeMapping[] { _jsonbString, _jsonbDocument, _jsonbElement } },
                { "json", new RelationalTypeMapping[] { _jsonString, _jsonDocument, _jsonElement } },
                { "xml", new[] { _xml } },
                { "citext", new[] { _citext } },
                { "character varying", new[] { _varchar } },
                { "varchar", new[] { _varchar } },
                { "character", new[] { _char } },
                { "char", new[] { _char } },
                { "char(1)", new RelationalTypeMapping[] { _singleChar, _stringAsSingleChar } },
                { "character(1)", new RelationalTypeMapping[] { _singleChar, _stringAsSingleChar } },
                { "date", new[] { _date } },
                { "timestamp without time zone", new[] { _timestamp } },
                { "timestamp", new[] { _timestamp } },
                { "timestamp with time zone", new[] { _timestamptz, _timestamptzDto } },
                { "timestamptz", new[] { _timestamptz, _timestamptzDto } },
                { "interval", new[] { _interval } },
                { "time without time zone", new[] { _time } },
                { "time", new[] { _time } },
                { "time with time zone", new[] { _timetz } },
                { "timetz", new[] { _timetz } },
                { "macaddr", new[] { _macaddr } },
                { "macaddr8", new[] { _macaddr8 } },
                { "inet", new[] { _inet } },
                { "cidr", new[] { _cidr } },
                { "bit", new[] { _bit } },
                { "bit varying", new[] { _varbit } },
                { "varbit", new[] { _varbit } },
                { "hstore", new[] { _hstore } },
                { "point", new[] { _point } },
                { "box", new[] { _box } },
                { "line", new[] { _line } },
                { "lseg", new[] { _lseg } },
                { "path", new[] { _path } },
                { "polygon", new[] { _polygon } },
                { "circle", new[] { _circle } },
                { "xid", new[] { _xid } },
                { "oid", new[] { _oid } },
                { "cid", new[] { _cid } },
                { "regtype", new[] { _regtype } },
                { "lo", new[] { _lo } },
                { "tid", new[] { _tid } },

                { "int4range", new[] { _int4range } },
                { "int8range", new[] { _int8range } },
                { "numrange", new[] { _numrange } },
                { "tsrange", new[] { _tsrange } },
                { "tstzrange", new[] { _tstzrange } },
                { "daterange", new[] { _daterange } },

                { "tsquery", new[] { _tsquery } },
                { "tsvector", new[] { _tsvector } },
                { "regconfig", new[] { _regconfig } }
            };

            var clrTypeMappings = new Dictionary <Type, RelationalTypeMapping>
            {
                { typeof(bool), _bool },