Beispiel #1
0
        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();
        }
Beispiel #2
0
        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();
        }