Пример #1
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 JetQuerySqlGeneratorFactory(
     [NotNull] QuerySqlGeneratorDependencies dependencies,
     [NotNull] IJetOptions jetOptions)
     : base(dependencies)
 {
     _jetOptions = jetOptions;
 }
Пример #2
0
 public JetTimeSpanTypeMapping(
     [NotNull] string storeType,
     [NotNull] IJetOptions options)
     : base(storeType, options, System.Data.DbType.Time, typeof(TimeSpan))
 {
     _options = options;
 }
 public JetDateTimeTypeMapping(
     [NotNull] string storeType,
     [NotNull] IJetOptions options,
     DbType?dbType            = null,
     [CanBeNull] Type clrType = null)
     : base(storeType, clrType ?? typeof(DateTime), dbType ?? System.Data.DbType.DateTime)
 {
     _options = options;
 }
 public JetQueryTranslationPostprocessorFactory(
     QueryTranslationPostprocessorDependencies dependencies,
     RelationalQueryTranslationPostprocessorDependencies relationalDependencies,
     IJetOptions options)
 {
     _dependencies           = dependencies;
     _relationalDependencies = relationalDependencies;
     _options = options;
 }
 public JetQueryTranslationPostprocessor(
     QueryTranslationPostprocessorDependencies dependencies,
     RelationalQueryTranslationPostprocessorDependencies relationalDependencies,
     QueryCompilationContext queryCompilationContext,
     IJetOptions options)
     : base(dependencies, relationalDependencies, queryCompilationContext)
 {
     _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 JetQuerySqlGeneratorFactory(
     [NotNull] QuerySqlGeneratorDependencies dependencies,
     [NotNull] ISqlExpressionFactory sqlExpressionFactory,
     [NotNull] ITypeMappingSource typeMappingSource,
     [NotNull] IJetOptions options)
 {
     _dependencies         = dependencies;
     _sqlExpressionFactory = (JetSqlExpressionFactory)sqlExpressionFactory;
     _typeMappingSource    = typeMappingSource;
     _options = options;
 }
Пример #7
0
 public JetQueryTranslationPostprocessorFactory(
     QueryTranslationPostprocessorDependencies dependencies,
     RelationalQueryTranslationPostprocessorDependencies relationalDependencies,
     IRelationalTypeMappingSource relationalTypeMappingSource,
     IJetOptions options)
 {
     _dependencies                = dependencies;
     _relationalDependencies      = relationalDependencies;
     _relationalTypeMappingSource = relationalTypeMappingSource;
     _options = options;
 }
 public JetQueryTranslationPostprocessor(
     QueryTranslationPostprocessorDependencies dependencies,
     RelationalQueryTranslationPostprocessorDependencies relationalDependencies,
     QueryCompilationContext queryCompilationContext,
     IRelationalTypeMappingSource relationalTypeMappingSource,
     IJetOptions options)
     : base(dependencies, relationalDependencies, queryCompilationContext)
 {
     _relationalTypeMappingSource = relationalTypeMappingSource;
     _options = options;
 }
 /// <summary>
 ///     Creates a new <see cref="JetMigrationsSqlGenerator" /> instance.
 /// </summary>
 /// <param name="dependencies"> Parameter object containing dependencies for this service. </param>
 /// <param name="migrationsAnnotations"> Provider-specific Migrations annotations to use. </param>
 /// <param name="options"> Provider-specific options. </param>
 public JetMigrationsSqlGenerator(
     [NotNull] MigrationsSqlGeneratorDependencies dependencies,
     [NotNull] IMigrationsAnnotationProvider migrationsAnnotations,
     [NotNull] IJetOptions options)
     : base(dependencies)
 {
     _migrationsAnnotations = migrationsAnnotations;
     _options           = options;
     _stringTypeMapping = dependencies.TypeMappingSource.FindMapping(typeof(string));
     _keepBreakingCharactersStringTypeMapping = ((JetStringTypeMapping)_stringTypeMapping).Clone(keepLineBreakCharacters: 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 JetQuerySqlGenerator(
     [NotNull] QuerySqlGeneratorDependencies dependencies,
     ISqlExpressionFactory sqlExpressionFactory,
     ITypeMappingSource typeMappingSource,
     IJetOptions options)
     : base(dependencies)
 {
     _sqlExpressionFactory = (JetSqlExpressionFactory)sqlExpressionFactory;
     _typeMappingSource    = typeMappingSource;
     _options             = options;
     _sqlGenerationHelper = dependencies.SqlGenerationHelper;
     _boolTypeMapping     = _typeMappingSource.FindMapping(typeof(bool));
 }
Пример #11
0
 public JetDateTimeOffsetTypeMapping(
     [NotNull] string storeType,
     [NotNull] IJetOptions options)
     : base(
         storeType,
         options,
         System.Data.DbType.DateTime,
         typeof(DateTimeOffset)) // delibrately use DbType.DateTime, because OleDb will throw a
                                 // "No mapping exists from DbType DateTimeOffset to a known OleDbType."
                                 // exception when using DbType.DateTimeOffset.
 {
     _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 JetTypeMappingSource(
            [NotNull] TypeMappingSourceDependencies dependencies,
            [NotNull] RelationalTypeMappingSourceDependencies relationalDependencies,
            [NotNull] IJetOptions options)
            : 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)

            _datetime       = new JetDateTimeTypeMapping("datetime", options, dbType: DbType.DateTime);
            _datetimeoffset = new JetDateTimeOffsetTypeMapping("datetime", options);
            _date           = new JetDateTimeTypeMapping("datetime", options, dbType: DbType.Date);
            _time           = new JetTimeSpanTypeMapping("datetime", options);

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

                { "varbinary", new[] { _variableLengthBinary } },
                { "binary varying", new[] { _variableLengthBinary } },
                { "bit varying", new[] { _variableLengthBinary } },

                { "longbinary", new[] { _unboundedBinary } },
                { "general", new[] { _unboundedBinary } },
                { "image", new[] { _unboundedBinary } },
                { "oleobject", new[] { _unboundedBinary } },

                { "bit", new[] { _bit } },
                { "boolean", new[] { _bit } },
                { "logical", new[] { _bit } },
                { "logical1", new[] { _bit } },
                { "yesno", new[] { _bit } },

                { "counter", new[] { _counter } },
                { "identity", new[] { _counter } },
                { "autoincrement", new[] { _counter } },

                { "byte", new[] { _byte } },
                { "tinyint", new[] { _byte } },
                { "integer1", new[] { _byte } },

                { "smallint", new[] { _smallint } },
                { "short", new[] { _smallint } },
                { "integer2", new[] { _smallint } },

                { "integer", new[] { _integer } },
                { "long", new[] { _integer } },
                { "int", new[] { _integer } },
                { "integer4", new[] { _integer } },

                { "single", new[] { _single } },
                { "real", new[] { _single } },
                { "float4", new[] { _single } },
                { "ieeesingle", new[] { _single } },

                { "double", new[] { _double } },
                { "float", new[] { _double } },
                { "float8", new[] { _double } },
                { "ieeedouble", new[] { _double } },
                { "number", new[] { _double } },

                { "decimal", new[] { _decimal } },
                { "numeric", new[] { _decimal } },
                { "dec", new[] { _decimal } },

                { "currency", new[] { _currency } },
                { "money", new[] { _currency } },

                { "datetime", new RelationalTypeMapping[] { _datetime, _datetimeoffset } },
                { "date", new[] { _date } },
                { "time", new[] { _time } },

                { "char", new[] { _fixedLengthUnicodeString } },
                { "alphanumeric", new[] { _fixedLengthUnicodeString } },
                { "character", new[] { _fixedLengthUnicodeString } },
                { "nchar", new[] { _fixedLengthUnicodeString } },
                { "national char", new[] { _fixedLengthUnicodeString } },
                { "national character", new[] { _fixedLengthUnicodeString } },

                { "varchar", new[] { _variableLengthUnicodeString } },
                { "string", new[] { _variableLengthUnicodeString } },
                { "char varying", new[] { _variableLengthUnicodeString } },
                { "character varying", new[] { _variableLengthUnicodeString } },
                { "national char varying", new[] { _variableLengthUnicodeString } },
                { "national character varying", new[] { _variableLengthUnicodeString } },

                { "longchar", new[] { _unboundedUnicodeString } },
                { "longtext", new[] { _unboundedUnicodeString } },
                { "memo", new[] { _unboundedUnicodeString } },
                { "note", new[] { _unboundedUnicodeString } },
                { "ntext", new[] { _unboundedUnicodeString } },

                { "guid", new[] { _guid } },
                { "uniqueidentifier", new[] { _guid } },

                { "timestamp", new[] { _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",
                };
        }
Пример #13
0
 protected JetTimeSpanTypeMapping(RelationalTypeMappingParameters parameters, IJetOptions options)
     : base(parameters, options)
 {
 }
Пример #14
0
 protected JetDateTimeOffsetTypeMapping(RelationalTypeMappingParameters parameters, IJetOptions options)
     : base(parameters, options)
 {
 }
 protected JetDateTimeTypeMapping(RelationalTypeMappingParameters parameters, IJetOptions options)
     : base(parameters)
 {
     _options = options;
 }