public RelationalCompiledQueryCacheKeyGenerator(
            [NotNull] IModel model, [NotNull] IDbContextOptions contextOptions)
            : base(model)
        {
            Check.NotNull(contextOptions, nameof(contextOptions));

            _contextOptions = contextOptions;
        }
 public DatabaseProviderSelector(
     [NotNull] IServiceProvider serviceProvider,
     [NotNull] IDbContextOptions contextOptions,
     [CanBeNull] IEnumerable<IDatabaseProvider> providers)
 {
     _serviceProvider = serviceProvider;
     _contextOptions = contextOptions;
     _providers = providers?.ToArray() ?? new IDatabaseProvider[0];
 }
        public SqlServerCompiledQueryCacheKeyGenerator(
            [NotNull] IModel model,
            [NotNull] IDbContextOptions dbContextOptions)
            : base(model, dbContextOptions)
        {
            Check.NotNull(dbContextOptions, nameof(dbContextOptions));

            _dbContextOptions = dbContextOptions;
        }
        public SqlServerCompiledQueryCacheKeyGenerator(
            [NotNull] IModel model,
            [NotNull] DbContext context,
            [NotNull] IDbContextOptions contextOptions)
            : base(model, context, contextOptions)
        {
            Check.NotNull(contextOptions, nameof(contextOptions));

            _contextOptions = contextOptions;
        }
 public FakeRelationalDataStore(
     IModel model,
     IEntityKeyFactorySource entityKeyFactorySource,
     IEntityMaterializerSource entityMaterializerSource,
     IRelationalConnection connection,
     CommandBatchPreparer batchPreparer,
     BatchExecutor batchExecutor,
     IDbContextOptions options,
     ILoggerFactory loggerFactory)
     : base(model, entityKeyFactorySource, entityMaterializerSource, connection, batchPreparer, batchExecutor, options, loggerFactory)
 {
 }
        public DataStoreSelector(
            [NotNull] IServiceProvider serviceProvider,
            [NotNull] IDbContextOptions contextOptions,
            [CanBeNull] IEnumerable<IDataStoreSource> sources)
        {
            Check.NotNull(serviceProvider, nameof(serviceProvider));
            Check.NotNull(contextOptions, nameof(contextOptions));

            _serviceProvider = serviceProvider;
            _contextOptions = contextOptions;
            _sources = sources == null ? new IDataStoreSource[0] : sources.ToArray();
        }
        /// <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 virtual IDbContextServices Initialize(
            IServiceProvider scopedProvider,
            IDbContextOptions contextOptions,
            DbContext context)
        {
            _scopedProvider = scopedProvider;
            _contextOptions = contextOptions;
            _currentContext = new CurrentDbContext(context);

            _providerServices = new LazyRef<IDatabaseProviderServices>(() =>
                _scopedProvider.GetRequiredService<IDatabaseProviderSelector>().SelectServices());

            _modelFromSource = new LazyRef<IModel>(CreateModel);

            return this;
        }
        public SqlServerModificationCommandBatchFactory(
            [NotNull] IRelationalCommandBuilderFactory commandBuilderFactory,
            [NotNull] ISqlServerUpdateSqlGenerator updateSqlGenerator,
            [NotNull] IRelationalValueBufferFactoryFactory valueBufferFactoryFactory,
            [NotNull] IDbContextOptions options)
        {
            Check.NotNull(commandBuilderFactory, nameof(commandBuilderFactory));
            Check.NotNull(updateSqlGenerator, nameof(updateSqlGenerator));
            Check.NotNull(valueBufferFactoryFactory, nameof(valueBufferFactoryFactory));
            Check.NotNull(options, nameof(options));

            _commandBuilderFactory = commandBuilderFactory;
            _updateSqlGenerator = updateSqlGenerator;
            _valueBufferFactoryFactory = valueBufferFactoryFactory;
            _options = options;
        }
        public virtual IServiceProvider GetOrAdd(IDbContextOptions options)
        {
            var services = new ServiceCollection();
            var builder = services.AddEntityFramework();

            foreach (var extension in options.Extensions)
            {
                extension.ApplyServices(builder);
            }

            // Decided that this hashing algorithm is robust enough. See issue #762.
            unchecked
            {
                var key = services.Aggregate(0, (t, d) => (t * 397) ^ CalculateHash(d).GetHashCode());

                return _configurations.GetOrAdd(key, k => services.BuildServiceProvider());
            }
        }
 public MyHistoryRepository(
     IDatabaseCreator databaseCreator,
     IRawSqlCommandBuilder rawSqlCommandBuilder,
     IRelationalConnection connection,
     IDbContextOptions options,
     IMigrationsModelDiffer modelDiffer,
     IMigrationsSqlGenerator migrationsSqlGenerator,
     IRelationalAnnotationProvider annotations,
     ISqlGenerationHelper sqlGenerationHelper)
     : base(databaseCreator,
         rawSqlCommandBuilder,
         connection,
         options,
         modelDiffer,
         migrationsSqlGenerator,
         annotations,
         sqlGenerationHelper
         )
 {
 }
        public virtual IDbContextServices Initialize(
            IServiceProvider scopedProvider, 
            IDbContextOptions contextOptions, 
            DbContext context,
            ServiceProviderSource serviceProviderSource)
        {
            Check.NotNull(scopedProvider, nameof(scopedProvider));
            Check.NotNull(contextOptions, nameof(contextOptions));
            Check.NotNull(context, nameof(context));
            Check.IsDefined(serviceProviderSource, nameof(serviceProviderSource));

            _provider = scopedProvider;
            _contextOptions = contextOptions;
            _context = context;

            _dataStoreServices = new LazyRef<IDataStoreServices>(() =>
                _provider.GetRequiredService<IDataStoreSelector>().SelectDataStore(serviceProviderSource));

            _modelFromSource = new LazyRef<IModel>(CreateModel);

            return this;
        }
Beispiel #12
0
 /// <summary>
 ///     Clones this dependency parameter object with one service replaced.
 /// </summary>
 /// <param name="contextOptions">
 ///     A replacement for the current dependency of this type.
 /// </param>
 /// <returns> A new parameter object with the given service replaced. </returns>
 public RelationalConnectionDependencies With([NotNull] IDbContextOptions contextOptions)
 => new RelationalConnectionDependencies(Check.NotNull(contextOptions, nameof(contextOptions)), Logger, DiagnosticSource);
Beispiel #13
0
 public void Initialize(IDbContextOptions options)
 {
 }
Beispiel #14
0
 public BlogDbContext(IDbContextOptions options) : base(options)
 {
 }
Beispiel #15
0
        public virtual void Validate(IDbContextOptions options)
        {
            var mySqlOptions       = options.FindExtension <MySqlOptionsExtension>() ?? new MySqlOptionsExtension();
            var connectionSettings = GetConnectionSettings(mySqlOptions);

            if (!Equals(ServerVersion, mySqlOptions.ServerVersion ?? new ServerVersion(null)))
            {
                throw new InvalidOperationException(
                          CoreStrings.SingletonOptionChanged(
                              nameof(MySqlDbContextOptionsBuilder.ServerVersion),
                              nameof(DbContextOptionsBuilder.UseInternalServiceProvider)));
            }

            if (!Equals(ConnectionSettings.TreatTinyAsBoolean, connectionSettings.TreatTinyAsBoolean))
            {
                throw new InvalidOperationException(
                          CoreStrings.SingletonOptionChanged(
                              nameof(MySqlConnectionStringBuilder.TreatTinyAsBoolean),
                              nameof(DbContextOptionsBuilder.UseInternalServiceProvider)));
            }

            if (!Equals(ConnectionSettings.GuidFormat, connectionSettings.GuidFormat))
            {
                throw new InvalidOperationException(
                          CoreStrings.SingletonOptionChanged(
                              nameof(MySqlConnectionStringBuilder.GuidFormat),
                              nameof(DbContextOptionsBuilder.UseInternalServiceProvider)));
            }

            if (!Equals(CharSetBehavior, mySqlOptions.NullableCharSetBehavior ?? CharSetBehavior.AppendToAllColumns))
            {
                throw new InvalidOperationException(
                          CoreStrings.SingletonOptionChanged(
                              nameof(MySqlDbContextOptionsBuilder.CharSetBehavior),
                              nameof(DbContextOptionsBuilder.UseInternalServiceProvider)));
            }

            if (!Equals(CharSet, mySqlOptions.CharSet ?? CharSet.Utf8Mb4))
            {
                throw new InvalidOperationException(
                          CoreStrings.SingletonOptionChanged(
                              nameof(MySqlDbContextOptionsBuilder.CharSet),
                              nameof(DbContextOptionsBuilder.UseInternalServiceProvider)));
            }

            if (!Equals(NoBackslashEscapes, mySqlOptions.NoBackslashEscapes))
            {
                throw new InvalidOperationException(
                          CoreStrings.SingletonOptionChanged(
                              nameof(MySqlDbContextOptionsBuilder.DisableBackslashEscaping),
                              nameof(DbContextOptionsBuilder.UseInternalServiceProvider)));
            }

            if (!Equals(ReplaceLineBreaksWithCharFunction, mySqlOptions.ReplaceLineBreaksWithCharFunction))
            {
                throw new InvalidOperationException(
                          CoreStrings.SingletonOptionChanged(
                              nameof(MySqlDbContextOptionsBuilder.DisableLineBreakToCharSubstition),
                              nameof(DbContextOptionsBuilder.UseInternalServiceProvider)));
            }

            if (!Equals(DefaultDataTypeMappings, ApplyDefaultDataTypeMappings(mySqlOptions.DefaultDataTypeMappings ?? new MySqlDefaultDataTypeMappings(), connectionSettings)))
            {
                throw new InvalidOperationException(
                          CoreStrings.SingletonOptionChanged(
                              nameof(MySqlDbContextOptionsBuilder.DefaultDataTypeMappings),
                              nameof(DbContextOptionsBuilder.UseInternalServiceProvider)));
            }

            if (!Equals(SchemaNameTranslator, mySqlOptions.SchemaNameTranslator))
            {
                throw new InvalidOperationException(
                          CoreStrings.SingletonOptionChanged(
                              nameof(MySqlDbContextOptionsBuilder.SchemaBehavior),
                              nameof(DbContextOptionsBuilder.UseInternalServiceProvider)));
            }
        }
 public NamingConventionSetPlugin([NotNull] IDbContextOptions options) => _options = options;
 public FakeSqlServerConnection(IDbContextOptions options, ILoggerFactory loggerFactory)
     : base(options, new Logger<SqlServerConnection>(loggerFactory))
 {
     _options = options;
     _loggerFactory = loggerFactory;
 }
Beispiel #18
0
 public CodeGeneratorDbContext(IDbContextOptions options, IServiceProvider serviceProvider) : base(options, serviceProvider)
 {
 }
 public override ModificationCommandBatch Create(IDbContextOptions options)
 {
     return new TestModificationCommandBatch(SqlGenerator);
 }
 private SqlServerConnection(
     [NotNull] IDbContextOptions options, [NotNull] ILogger logger)
     : base(options, logger)
 {
 }
Beispiel #21
0
 public override ModificationCommandBatch Create(IDbContextOptions options)
 {
     return(new TestModificationCommandBatch(SqlGenerator));
 }
 /// <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 static IFileContextStore GetStore([NotNull] this IFileContextStoreCache storeCache, [NotNull] IDbContextOptions options)
 => storeCache.GetStore(options.Extensions.OfType <FileContextOptionsExtension>().First().Options);
Beispiel #23
0
 public FakeSqlServerConnection(IDbContextOptions options, ILoggerFactory loggerFactory)
     : base(options, new Logger <SqlServerConnection>(loggerFactory))
 {
     _options       = options;
     _loggerFactory = loggerFactory;
 }
Beispiel #24
0
 public GirvsMigrationByTenantAssembly(ICurrentDbContext currentContext,
                                       IDbContextOptions options, IMigrationsIdGenerator idGenerator,
                                       IDiagnosticsLogger <DbLoggerCategory.Migrations> logger)
     : base(currentContext, options, idGenerator, logger)
 {
 }
Beispiel #25
0
 /// <summary>
 ///     Clones this dependency parameter object with one service replaced.
 /// </summary>
 /// <param name="contextOptions"> A replacement for the current dependency of this type. </param>
 /// <returns> A new parameter object with the given service replaced. </returns>
 public RelationalCompiledQueryCacheKeyGeneratorDependencies With([NotNull] IDbContextOptions contextOptions)
 => new RelationalCompiledQueryCacheKeyGeneratorDependencies(contextOptions);
Beispiel #26
0
        public RelationalCompiledQueryCacheKeyGeneratorDependencies([NotNull] IDbContextOptions contextOptions)
        {
            Check.NotNull(contextOptions, nameof(contextOptions));

            ContextOptions = contextOptions;
        }
 public FakeConnection(IDbContextOptions options)
     : base(options, new LoggerFactory())
 {
 }
 public QuartzDbContext(IDbContextOptions options) : base(options)
 {
 }
 /// <summary>
 /// Initialises a new instance of <see cref="RelationalQueryModelVisitor"/>
 /// </summary>
 public RelationalQueryModelVisitor(IModel model, IQueryOptimizer queryOptimizer, INavigationRewritingExpressionVisitorFactory navigationRewritingExpressionVisitorFactory, ISubQueryMemberPushDownExpressionVisitor subQueryMemberPushDownExpressionVisitor, IQuerySourceTracingExpressionVisitorFactory querySourceTracingExpressionVisitorFactory, IEntityResultFindingExpressionVisitorFactory entityResultFindingExpressionVisitorFactory, ITaskBlockingExpressionVisitor taskBlockingExpressionVisitor, IMemberAccessBindingExpressionVisitorFactory memberAccessBindingExpressionVisitorFactory, IOrderingExpressionVisitorFactory orderingExpressionVisitorFactory, IProjectionExpressionVisitorFactory projectionExpressionVisitorFactory, IEntityQueryableExpressionVisitorFactory entityQueryableExpressionVisitorFactory, IQueryAnnotationExtractor queryAnnotationExtractor, IResultOperatorHandler resultOperatorHandler, IEntityMaterializerSource entityMaterializerSource, IExpressionPrinter expressionPrinter, IRelationalAnnotationProvider relationalAnnotationProvider, IIncludeExpressionVisitorFactory includeExpressionVisitorFactory, ISqlTranslatingExpressionVisitorFactory sqlTranslatingExpressionVisitorFactory, ICompositePredicateExpressionVisitorFactory compositePredicateExpressionVisitorFactory, IQueryFlatteningExpressionVisitorFactory queryFlatteningExpressionVisitorFactory, IShapedQueryFindingExpressionVisitorFactory shapedQueryFindingExpressionVisitorFactory, IDbContextOptions contextOptions, RelationalQueryCompilationContext queryCompilationContext, EFRelationalQueryModelVisitor parentQueryModelVisitor)
     : base(model, queryOptimizer, navigationRewritingExpressionVisitorFactory, subQueryMemberPushDownExpressionVisitor, querySourceTracingExpressionVisitorFactory, entityResultFindingExpressionVisitorFactory, taskBlockingExpressionVisitor, memberAccessBindingExpressionVisitorFactory, orderingExpressionVisitorFactory, projectionExpressionVisitorFactory, entityQueryableExpressionVisitorFactory, queryAnnotationExtractor, resultOperatorHandler, entityMaterializerSource, expressionPrinter, relationalAnnotationProvider, includeExpressionVisitorFactory, sqlTranslatingExpressionVisitorFactory, compositePredicateExpressionVisitorFactory, queryFlatteningExpressionVisitorFactory, shapedQueryFindingExpressionVisitorFactory, contextOptions, queryCompilationContext, parentQueryModelVisitor)
 {
 }
        /// <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 virtual IServiceProvider GetOrAdd([NotNull] IDbContextOptions options, bool providerRequired)
        {
            foreach (var extension in options.Extensions)
            {
                extension.Validate(options);
            }

            var key = options.Extensions
                      .OrderBy(e => e.GetType().Name)
                      .Aggregate(0L, (t, e) => (t * 397) ^ ((long)e.GetType().GetHashCode() * 397) ^ e.GetServiceProviderHashCode());

            var internalServiceProvider = options.FindExtension <CoreOptionsExtension>()?.InternalServiceProvider;

            if (internalServiceProvider != null)
            {
                var optionsInitialzer = internalServiceProvider.GetService <ISingletonOptionsInitialzer>();
                if (optionsInitialzer == null)
                {
                    throw new InvalidOperationException(CoreStrings.NoEfServices);
                }

                if (providerRequired)
                {
                    optionsInitialzer.EnsureInitialized(internalServiceProvider, options);
                }

                return(internalServiceProvider);
            }

            return(_configurations.GetOrAdd(
                       key,
                       k =>
            {
                var services = new ServiceCollection();
                var hasProvider = ApplyServices(options, services);

                var replacedServices = options.FindExtension <CoreOptionsExtension>()?.ReplacedServices;
                if (replacedServices != null)
                {
                    // For replaced services we use the service collection to obtain the lifetime of
                    // the service to replace. The replaced services are added to a new collection, after
                    // which provider and core services are applied. This ensures that any patching happens
                    // to the replaced service.
                    var updatedServices = new ServiceCollection();
                    foreach (var descriptor in services)
                    {
                        Type replacementType;
                        if (replacedServices.TryGetValue(descriptor.ServiceType, out replacementType))
                        {
                            ((IList <ServiceDescriptor>)updatedServices).Add(
                                new ServiceDescriptor(descriptor.ServiceType, replacementType, descriptor.Lifetime));
                        }
                    }

                    ApplyServices(options, updatedServices);
                    services = updatedServices;
                }

                var serviceProvider = services.BuildServiceProvider();

                if (hasProvider)
                {
                    serviceProvider
                    .GetRequiredService <ISingletonOptionsInitialzer>()
                    .EnsureInitialized(serviceProvider, options);
                }

                var logger = serviceProvider.GetRequiredService <IDiagnosticsLogger <DbLoggerCategory.Infrastructure> >();

                logger.ServiceProviderCreated(serviceProvider);

                if (_configurations.Count >= 20)
                {
                    logger.ManyServiceProvidersCreatedWarning(_configurations.Values);
                }

                return serviceProvider;
            }));
        }
Beispiel #31
0
        public virtual void Validate(IDbContextOptions options)
        {
            var mySqlOptions       = options.FindExtension <MySqlOptionsExtension>() ?? new MySqlOptionsExtension();
            var mySqlJsonOptions   = (MySqlJsonOptionsExtension)options.Extensions.LastOrDefault(e => e is MySqlJsonOptionsExtension);
            var connectionSettings = GetConnectionSettings(mySqlOptions);

            if (!Equals(ServerVersion, mySqlOptions.ServerVersion))
            {
                throw new InvalidOperationException(
                          CoreStrings.SingletonOptionChanged(
                              nameof(MySqlOptionsExtension.ServerVersion),
                              nameof(DbContextOptionsBuilder.UseInternalServiceProvider)));
            }

            if (!Equals(ConnectionSettings.TreatTinyAsBoolean, connectionSettings.TreatTinyAsBoolean))
            {
                throw new InvalidOperationException(
                          CoreStrings.SingletonOptionChanged(
                              nameof(MySqlConnectionStringBuilder.TreatTinyAsBoolean),
                              nameof(DbContextOptionsBuilder.UseInternalServiceProvider)));
            }

            if (!Equals(ConnectionSettings.GuidFormat, connectionSettings.GuidFormat))
            {
                throw new InvalidOperationException(
                          CoreStrings.SingletonOptionChanged(
                              nameof(MySqlConnectionStringBuilder.GuidFormat),
                              nameof(DbContextOptionsBuilder.UseInternalServiceProvider)));
            }

            if (!Equals(NoBackslashEscapes, mySqlOptions.NoBackslashEscapes))
            {
                throw new InvalidOperationException(
                          CoreStrings.SingletonOptionChanged(
                              nameof(MySqlDbContextOptionsBuilder.DisableBackslashEscaping),
                              nameof(DbContextOptionsBuilder.UseInternalServiceProvider)));
            }

            if (!Equals(ReplaceLineBreaksWithCharFunction, mySqlOptions.ReplaceLineBreaksWithCharFunction))
            {
                throw new InvalidOperationException(
                          CoreStrings.SingletonOptionChanged(
                              nameof(MySqlDbContextOptionsBuilder.DisableLineBreakToCharSubstition),
                              nameof(DbContextOptionsBuilder.UseInternalServiceProvider)));
            }

            if (!Equals(DefaultDataTypeMappings, ApplyDefaultDataTypeMappings(mySqlOptions.DefaultDataTypeMappings ?? new MySqlDefaultDataTypeMappings(), connectionSettings)))
            {
                throw new InvalidOperationException(
                          CoreStrings.SingletonOptionChanged(
                              nameof(MySqlDbContextOptionsBuilder.DefaultDataTypeMappings),
                              nameof(DbContextOptionsBuilder.UseInternalServiceProvider)));
            }

            if (!Equals(
                    SchemaNameTranslator,
                    mySqlOptions.SchemaBehavior == MySqlSchemaBehavior.Ignore
                    ? _ignoreSchemaNameTranslator
                    : SchemaNameTranslator))
            {
                throw new InvalidOperationException(
                          CoreStrings.SingletonOptionChanged(
                              nameof(MySqlDbContextOptionsBuilder.SchemaBehavior),
                              nameof(DbContextOptionsBuilder.UseInternalServiceProvider)));
            }

            if (!Equals(IndexOptimizedBooleanColumns, mySqlOptions.IndexOptimizedBooleanColumns))
            {
                throw new InvalidOperationException(
                          CoreStrings.SingletonOptionChanged(
                              nameof(MySqlDbContextOptionsBuilder.EnableIndexOptimizedBooleanColumns),
                              nameof(DbContextOptionsBuilder.UseInternalServiceProvider)));
            }

            if (!Equals(JsonChangeTrackingOptions, mySqlJsonOptions?.JsonChangeTrackingOptions ?? default))
            {
                throw new InvalidOperationException(
                          CoreStrings.SingletonOptionChanged(
                              nameof(MySqlJsonOptionsExtension.JsonChangeTrackingOptions),
                              nameof(DbContextOptionsBuilder.UseInternalServiceProvider)));
            }

            if (!Equals(LimitKeyedOrIndexedStringColumnLength, mySqlOptions.LimitKeyedOrIndexedStringColumnLength))
            {
                throw new InvalidOperationException(
                          CoreStrings.SingletonOptionChanged(
                              nameof(MySqlDbContextOptionsBuilder.LimitKeyedOrIndexedStringColumnLength),
                              nameof(DbContextOptionsBuilder.UseInternalServiceProvider)));
            }

            if (!Equals(StringComparisonTranslations, mySqlOptions.StringComparisonTranslations))
            {
                throw new InvalidOperationException(
                          CoreStrings.SingletonOptionChanged(
                              nameof(MySqlDbContextOptionsBuilder.EnableStringComparisonTranslations),
                              nameof(DbContextOptionsBuilder.UseInternalServiceProvider)));
            }
        }
        public CompositePredicateExpressionVisitorFactory([NotNull] IDbContextOptions contextOptions)
        {
            Check.NotNull(contextOptions, nameof(contextOptions));

            _contextOptions = contextOptions;
        }
 public MyDatabaseCreator(IDbContextOptions options)
 {
     _myOptions = options.FindExtension<MyProviderOptionsExtension>();
 }
 public SqlCeDatabaseConnection([NotNull] IDbContextOptions options,
                                // ReSharper disable once SuggestBaseTypeForParameter
                                [NotNull] ILogger <SqlCeDatabaseConnection> logger)
     : base(options, logger)
 {
 }
 public bool IsConfigured(IDbContextOptions options) => true;
Beispiel #36
0
 public override ModificationCommandBatch Create(
     IDbContextOptions options,
     IRelationalMetadataExtensionProvider metadataExtensionProvider)
 {
     return(new SingularModificationCommandBatch(UpdateSqlGenerator));
 }
Beispiel #37
0
 /// <summary>
 ///     Gets a value indicating whether this database provider has been selected for a given context.
 /// </summary>
 /// <param name="options"> The options for the context. </param>
 /// <returns> True if the database provider has been selected, otherwise false. </returns>
 public virtual bool IsConfigured(IDbContextOptions options)
 => Check.NotNull(options, nameof(options)).Extensions.OfType <TOptionsExtension>().Any();
 public NoTransactionSqlServerConnection(IDbContextOptions options, ILogger<SqlServerConnection> logger)
     : base(options, logger)
 {
 }
            public override ModificationCommandBatch Create(IDbContextOptions options)
            {
                var optionsExtension = options.Extensions.OfType<SqlServerOptionsExtension>().FirstOrDefault();

                var maxBatchSize = optionsExtension?.MaxBatchSize;

                return new TestSqlServerModificationCommandBatch((ISqlServerSqlGenerator)SqlGenerator, maxBatchSize);
            }
Beispiel #40
0
 public void EnsureInitialized(IServiceProvider serviceProvider, IDbContextOptions options)
 {
 }
 private static FakeRelationalConnection CreateConnection(IDbContextOptions options = null)
 => new FakeRelationalConnection(options ?? CreateOptions());
Beispiel #42
0
 public BlogDbContext(IDbContextOptions options, IServiceProvider serviceProvider) : base(options, serviceProvider)
 {
 }
Beispiel #43
0
 public void Validate(IDbContextOptions options)
 {
 }
 private static FakeRelationalConnection CreateConnection(IDbContextOptions options = null)
     => new FakeRelationalConnection(options ?? CreateOptions());
 public FakeRelationalConnection(IDbContextOptions options)
     : base(options, new Logger<FakeRelationalConnection>(new LoggerFactory()))
 {
 }
 public override ModificationCommandBatch Create(
     IDbContextOptions options,
     IRelationalMetadataExtensionProvider metadataExtensionProvider)
 {
     return new SingularModificationCommandBatch(UpdateSqlGenerator);
 }
 public SqliteTestConnection(IDbContextOptions options)
     : base(options, new LoggerFactory())
 {
 }
 public MyRelationalConnection(IDbContextOptions options, ILogger logger)
     : base(options, logger)
 {
 }
 public FakeRelationalDatabase(
     IModel model,
     IEntityKeyFactorySource entityKeyFactorySource,
     IEntityMaterializerSource entityMaterializerSource,
     IClrAccessorSource<IClrPropertyGetter> clrPropertyGetterSource,
     IRelationalConnection connection,
     ICommandBatchPreparer batchPreparer,
     IBatchExecutor batchExecutor,
     IDbContextOptions options,
     ILoggerFactory loggerFactory,
     IRelationalValueBufferFactoryFactory valueBufferFactoryFactory,
     IMethodCallTranslator compositeMethodCallTranslator,
     IMemberTranslator compositeMemberTranslator,
     IRelationalTypeMapper typeMapper)
     : base(
           model, 
           entityKeyFactorySource, 
           entityMaterializerSource,
           clrPropertyGetterSource,
           connection, 
           batchPreparer, 
           batchExecutor, 
           options, 
           loggerFactory,
           valueBufferFactoryFactory,
           compositeMethodCallTranslator,
           compositeMemberTranslator,
           typeMapper)
 {
 }
Beispiel #50
0
 public void Validate(IDbContextOptions options)
 {
     _ = options.FindExtension <MySQLOptionsExtension>() ?? new MySQLOptionsExtension();
 }
 public FileContextIntegerValueGeneratorFactory(IFileContextStoreCache _storeCache, FileContextIntegerValueGeneratorCache _idCache, IDbContextOptions _contextOptions)
 {
     storeCache = _storeCache;
     idCache    = _idCache;
     options    = _contextOptions.Extensions.OfType <FileContextOptionsExtension>().First();
 }
Beispiel #52
0
        /// <inheritdoc />
        public virtual void Initialize(IDbContextOptions options)
        {
            var npgsqlNtsOptions = options.FindExtension <NpgsqlNetTopologySuiteOptionsExtension>() ?? new NpgsqlNetTopologySuiteOptionsExtension();

            IsGeographyDefault = npgsqlNtsOptions.IsGeographyDefault;
        }
        public CompositePredicateExpressionVisitorFactory([NotNull] IDbContextOptions contextOptions)
        {
            Check.NotNull(contextOptions, nameof(contextOptions));

            _contextOptions = contextOptions;
        }
 public FakeSqlServerConnection(IDbContextOptions options, RelationalConnectionDependencies dependencies)
     : base(dependencies)
 {
     _options = options;
 }
 public FakeSqlServerConnection(IDbContextOptions options, ILoggerFactory loggerFactory)
     : base(options, loggerFactory)
 {
 }
Beispiel #56
0
 public DataContext(IDbContextOptions options)
 {
 }