/// <summary>
 ///     Clones this dependency parameter object with one service replaced.
 /// </summary>
 /// <param name="updateSqlGenerator"> A replacement for the current dependency of this type. </param>
 /// <returns> A new parameter object with the given service replaced. </returns>
 public MigrationsSqlGeneratorDependencies With([NotNull] IUpdateSqlGenerator updateSqlGenerator)
 => new MigrationsSqlGeneratorDependencies(
     CommandBuilderFactory,
     updateSqlGenerator,
     SqlGenerationHelper,
     TypeMappingSource,
     Logger);
Exemplo n.º 2
0
 public SingularModificationCommandBatch(
     [NotNull] IRelationalCommandBuilderFactory commandBuilderFactory,
     [NotNull] IUpdateSqlGenerator sqlGenerator,
     [NotNull] IRelationalValueBufferFactoryFactory valueBufferFactoryFactory)
     : base(commandBuilderFactory, sqlGenerator, valueBufferFactoryFactory)
 {
 }
 /// <summary>
 ///     Clones this dependency parameter object with one service replaced.
 /// </summary>
 /// <param name="updateSqlGenerator"> A replacement for the current dependency of this type. </param>
 /// <returns> A new parameter object with the given service replaced. </returns>
 public ModificationCommandBatchFactoryDependencies With([NotNull] IUpdateSqlGenerator updateSqlGenerator)
 => new ModificationCommandBatchFactoryDependencies(
     CommandBuilderFactory,
     SqlGenerationHelper,
     updateSqlGenerator,
     ValueBufferFactoryFactory,
     Logger);
Exemplo n.º 4
0
            private static ModificationCommandBatchFactoryDependencies CreateDependencies(
                IUpdateSqlGenerator sqlGenerator)
            {
                var typeMappingSource = new TestRelationalTypeMappingSource(
                    TestServiceFactory.Instance.Create <TypeMappingSourceDependencies>(),
                    TestServiceFactory.Instance.Create <RelationalTypeMappingSourceDependencies>());

                var logger = new FakeDiagnosticsLogger <DbLoggerCategory.Database.Command>();

                return(new ModificationCommandBatchFactoryDependencies(
                           new RelationalCommandBuilderFactory(
                               new RelationalCommandBuilderDependencies(
                                   typeMappingSource)),
                           new RelationalSqlGenerationHelper(
                               new RelationalSqlGenerationHelperDependencies()),
                           sqlGenerator
                           ?? new FakeSqlGenerator(
                               RelationalTestHelpers.Instance.CreateContextServices()
                               .GetRequiredService <UpdateSqlGeneratorDependencies>()),
                           new TypedRelationalValueBufferFactoryFactory(
                               new RelationalValueBufferFactoryDependencies(
                                   typeMappingSource,
                                   new CoreSingletonOptions())),
                           new CurrentDbContext(new FakeDbContext()),
                           logger));
            }
Exemplo n.º 5
0
 public ModificationCommandBatchFake(DbDataReader reader, IUpdateSqlGenerator sqlGenerator = null)
     : base(sqlGenerator ?? new FakeSqlGenerator())
 {
     _reader           = reader;
     ShouldAddCommand  = true;
     ShouldValidateSql = true;
 }
Exemplo n.º 6
0
 public ModificationCommandBatchFake(
     IUpdateSqlGenerator sqlGenerator = null)
     : base(CreateDependencies(sqlGenerator))
 {
     ShouldAddCommand  = true;
     ShouldValidateSql = true;
 }
Exemplo n.º 7
0
        public Migrator(
            [NotNull] IMigrationsAssembly migrationAssembly,
            [NotNull] IHistoryRepository historyRepository,
            [NotNull] IDatabaseCreator databaseCreator,
            [NotNull] IMigrationsSqlGenerator sqlGenerator,
            [NotNull] ISqlStatementExecutor executor,
            [NotNull] IRelationalConnection connection,
            [NotNull] IUpdateSqlGenerator sql,
            [NotNull] ILoggerFactory loggerFactory)
        {
            Check.NotNull(migrationAssembly, nameof(migrationAssembly));
            Check.NotNull(historyRepository, nameof(historyRepository));
            Check.NotNull(databaseCreator, nameof(databaseCreator));
            Check.NotNull(sqlGenerator, nameof(sqlGenerator));
            Check.NotNull(executor, nameof(executor));
            Check.NotNull(connection, nameof(connection));
            Check.NotNull(sql, nameof(sql));
            Check.NotNull(loggerFactory, nameof(loggerFactory));

            _migrationAssembly = migrationAssembly;
            _historyRepository = historyRepository;
            _databaseCreator   = (IRelationalDatabaseCreator)databaseCreator;
            _sqlGenerator      = sqlGenerator;
            _executor          = executor;
            _connection        = connection;
            _sql    = sql;
            _logger = new LazyRef <ILogger>(loggerFactory.CreateLogger <Migrator>);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 实例化
        /// </summary>
        /// <param name="commandBuilderFactory">命令创建器工厂</param>
        /// <param name="sqlGenerationHelper">SQL生成帮助器</param>
        /// <param name="updateSqlGenerator">UodateSql生成器</param>
        /// <param name="valueBufferFactoryFactory">值缓存工厂</param>
        /// <param name="maxBatchSize">最大批处理大小</param>
        /// <param name="logger"></param>
        public OracleModificationCommandBatch(
            [NotNull] IRelationalCommandBuilderFactory commandBuilderFactory,
            [NotNull] ISqlGenerationHelper sqlGenerationHelper,
            [NotNull] IUpdateSqlGenerator updateSqlGenerator,
            [NotNull] IRelationalValueBufferFactoryFactory valueBufferFactoryFactory,
            int?maxBatchSize, IDiagnosticsLogger <DbLoggerCategory.Update> logger = null)
            : base(commandBuilderFactory, sqlGenerationHelper, updateSqlGenerator, valueBufferFactoryFactory)
        {
            if (Check.IsTraceEnabled(logger?.Logger))
            {
                Trace <DbLoggerCategory.Update> .Write(logger, LogLevel.Trace, OracleTraceTag.Entry, OracleTraceClassName.OracleModificationCommandBatch, OracleTraceFuncName.ctor);
            }

            _commandBuilderFactory = commandBuilderFactory;
            _batchInsertCommands   = new Dictionary <ModificationCommand, int>();
            _cursorPositionList    = new List <int>();
            _variablesInsert       = new Dictionary <string, string>();
            _variablesCommand      = new StringBuilder();
            _maxBatchSize          = Math.Min(maxBatchSize ?? int.MaxValue, MaxRowCount);
            m_oracleLogger         = logger;

            if (Check.IsTraceEnabled(logger?.Logger))
            {
                Trace <DbLoggerCategory.Update> .Write(logger, LogLevel.Trace, OracleTraceTag.Exit, OracleTraceClassName.OracleModificationCommandBatch, OracleTraceFuncName.ctor);
            }
        }
Exemplo n.º 9
0
        public Migrator(
            [NotNull] IMigrationsAssembly migrationAssembly,
            [NotNull] IHistoryRepository historyRepository,
            [NotNull] IDatabaseCreator databaseCreator,
            [NotNull] IMigrationsSqlGenerator sqlGenerator,
            [NotNull] ISqlStatementExecutor executor,
            [NotNull] IRelationalConnection connection,
            [NotNull] IUpdateSqlGenerator sql,
            [NotNull] ILoggerFactory loggerFactory)
        {
            Check.NotNull(migrationAssembly, nameof(migrationAssembly));
            Check.NotNull(historyRepository, nameof(historyRepository));
            Check.NotNull(databaseCreator, nameof(databaseCreator));
            Check.NotNull(sqlGenerator, nameof(sqlGenerator));
            Check.NotNull(executor, nameof(executor));
            Check.NotNull(connection, nameof(connection));
            Check.NotNull(sql, nameof(sql));
            Check.NotNull(loggerFactory, nameof(loggerFactory));

            _migrationAssembly = migrationAssembly;
            _historyRepository = historyRepository;
            _databaseCreator = (IRelationalDatabaseCreator)databaseCreator;
            _sqlGenerator = sqlGenerator;
            _executor = executor;
            _connection = connection;
            _sql = sql;
            _logger = new LazyRef<ILogger>(loggerFactory.CreateLogger<Migrator>);
        }
 public ConcreteMigrationSqlGenerator(
     IUpdateSqlGenerator sqlGenerator,
     IRelationalTypeMapper typeMapper,
     IRelationalMetadataExtensionProvider annotations)
     : base(sqlGenerator, typeMapper, annotations)
 {
 }
Exemplo n.º 11
0
        protected ModificationCommandBatchFactory(
            [NotNull] IUpdateSqlGenerator sqlGenerator)
        {
            Check.NotNull(sqlGenerator, nameof(sqlGenerator));

            UpdateSqlGenerator = sqlGenerator;
        }
        /// <summary>
        /// 实例化
        /// </summary>
        /// <param name="commandBuilderFactory">命令创建器工厂</param>
        /// <param name="sqlGenerationHelper">SQL生成帮助器</param>
        /// <param name="updateSqlGenerator">UpdateSql生成器</param>
        /// <param name="valueBufferFactoryFactory">值缓存工厂</param>
        /// <param name="options">数据库上下文选项</param>
        /// <param name="logger">日志</param>
        public OracleModificationCommandBatchFactory(
            [NotNull] IRelationalCommandBuilderFactory commandBuilderFactory,
            [NotNull] ISqlGenerationHelper sqlGenerationHelper,
            [NotNull] IUpdateSqlGenerator updateSqlGenerator,
            [NotNull] IRelationalValueBufferFactoryFactory valueBufferFactoryFactory,
            [NotNull] IDbContextOptions options,
            IDiagnosticsLogger <DbLoggerCategory.Update> logger = null)
        {
            if (Check.IsTraceEnabled(logger?.Logger))
            {
                Trace <DbLoggerCategory.Update> .Write(logger, LogLevel.Trace, OracleTraceTag.Entry, OracleTraceClassName.OracleModificationCommandBatchFactory, OracleTraceFuncName.ctor);
            }

            Check.NotNull(commandBuilderFactory, nameof(commandBuilderFactory));
            Check.NotNull(sqlGenerationHelper, nameof(sqlGenerationHelper));
            Check.NotNull(updateSqlGenerator, nameof(updateSqlGenerator));
            Check.NotNull(valueBufferFactoryFactory, nameof(valueBufferFactoryFactory));
            Check.NotNull(options, nameof(options));
            _commandBuilderFactory     = commandBuilderFactory;
            _sqlGenerationHelper       = sqlGenerationHelper;
            _updateSqlGenerator        = updateSqlGenerator;
            _valueBufferFactoryFactory = valueBufferFactoryFactory;
            _options       = options;
            m_oracleLogger = logger;

            if (Check.IsTraceEnabled(logger?.Logger))
            {
                Trace <DbLoggerCategory.Update> .Write(logger, LogLevel.Trace, OracleTraceTag.Exit, OracleTraceClassName.OracleModificationCommandBatchFactory, OracleTraceFuncName.ctor);
            }
        }
    /// <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 NpgsqlSequenceValueGeneratorFactory(
        IUpdateSqlGenerator sqlGenerator)
    {
        Check.NotNull(sqlGenerator, nameof(sqlGenerator));

        _sqlGenerator = sqlGenerator;
    }
Exemplo n.º 14
0
        public MigrationsSqlGeneratorDependencies(
            [NotNull] IRelationalCommandBuilderFactory commandBuilderFactory,
            [NotNull] IUpdateSqlGenerator updateSqlGenerator,
            [NotNull] ISqlGenerationHelper sqlGenerationHelper,
            [NotNull] IRelationalTypeMappingSource typeMappingSource,
            [NotNull] ICurrentDbContext currentContext,
            [NotNull] ILoggingOptions loggingOptions,
            [NotNull] IDiagnosticsLogger <DbLoggerCategory.Database.Command> logger,
            [NotNull] IDiagnosticsLogger <DbLoggerCategory.Migrations> migrationsLogger)
        {
            Check.NotNull(commandBuilderFactory, nameof(commandBuilderFactory));
            Check.NotNull(updateSqlGenerator, nameof(updateSqlGenerator));
            Check.NotNull(sqlGenerationHelper, nameof(sqlGenerationHelper));
            Check.NotNull(typeMappingSource, nameof(typeMappingSource));
            Check.NotNull(currentContext, nameof(currentContext));
            Check.NotNull(loggingOptions, nameof(loggingOptions));
            Check.NotNull(logger, nameof(logger));
            Check.NotNull(migrationsLogger, nameof(migrationsLogger));

            CommandBuilderFactory = commandBuilderFactory;
            SqlGenerationHelper   = sqlGenerationHelper;
            UpdateSqlGenerator    = updateSqlGenerator;
            TypeMappingSource     = typeMappingSource;
            CurrentContext        = currentContext;
            LoggingOptions        = loggingOptions;
            Logger           = logger;
            MigrationsLogger = migrationsLogger;
        }
Exemplo n.º 15
0
 /// <summary>
 ///     Creates a new <see cref="AffectedCountModificationCommandBatch" /> instance.
 /// </summary>
 /// <param name="commandBuilderFactory"> The builder to build commands. </param>
 /// <param name="sqlGenerationHelper"> A helper for SQL generation. </param>
 /// <param name="updateSqlGenerator"> A SQL generator for insert, update, and delete commands. </param>
 /// <param name="valueBufferFactoryFactory">
 ///     A factory for creating factories for creating <see cref="ValueBuffer" />s to be used when reading from the data reader.
 /// </param>
 protected FbAffectedCountModificationCommandBatch(
     [NotNull] IRelationalCommandBuilderFactory commandBuilderFactory,
     [NotNull] ISqlGenerationHelper sqlGenerationHelper,
     [NotNull] IUpdateSqlGenerator updateSqlGenerator,
     [NotNull] IRelationalValueBufferFactoryFactory valueBufferFactoryFactory)
     : base(commandBuilderFactory, sqlGenerationHelper, updateSqlGenerator, valueBufferFactoryFactory)
 {
 }
 public FbModificationCommandBatchFactory(IRelationalCommandBuilderFactory commandBuilderFactory, ISqlGenerationHelper sqlGenerationHelper, IUpdateSqlGenerator updateSqlGenerator, IRelationalValueBufferFactoryFactory valueBufferFactoryFactory, IDbContextOptions options)
 {
     _commandBuilderFactory     = commandBuilderFactory;
     _sqlGenerationHelper       = sqlGenerationHelper;
     _updateSqlGenerator        = updateSqlGenerator;
     _valueBufferFactoryFactory = valueBufferFactoryFactory;
     _options = options;
 }
 public TestModificationCommandBatchFactory(
     IRelationalCommandBuilderFactory commandBuilderfactory,
     IUpdateSqlGenerator updateSqlGenerator,
     IRelationalValueBufferFactoryFactory valueBufferFactoryFactory)
 {
     _commandBuilderFactory     = commandBuilderfactory;
     _updateSqlGenerator        = updateSqlGenerator;
     _valueBufferFactoryFactory = valueBufferFactoryFactory;
 }
Exemplo n.º 18
0
 public ModificationCommandBatchFake(IUpdateSqlGenerator sqlGenerator = null)
     : base(
         new RelationalCommandBuilderFactory(new ConcreteTypeMapper()),
         sqlGenerator ?? new FakeSqlGenerator(),
         new TypedRelationalValueBufferFactoryFactory())
 {
     ShouldAddCommand  = true;
     ShouldValidateSql = true;
 }
Exemplo n.º 19
0
        protected AffectedCountModificationCommandBatch(
            [NotNull] IRelationalCommandBuilderFactory commandBuilderFactory,
            [NotNull] IUpdateSqlGenerator sqlGenerator,
            [NotNull] IRelationalValueBufferFactoryFactory valueBufferFactoryFactory)
            : base(commandBuilderFactory, sqlGenerator)
        {
            Check.NotNull(valueBufferFactoryFactory, nameof(valueBufferFactoryFactory));

            _valueBufferFactoryFactory = valueBufferFactoryFactory;
        }
Exemplo n.º 20
0
        public OracleSequenceValueGeneratorFactory(
            [NotNull] IRawSqlCommandBuilder rawSqlCommandBuilder,
            [NotNull] IUpdateSqlGenerator sqlGenerator)
        {
            Check.NotNull(rawSqlCommandBuilder, nameof(rawSqlCommandBuilder));
            Check.NotNull(sqlGenerator, nameof(sqlGenerator));

            _rawSqlCommandBuilder = rawSqlCommandBuilder;
            _sqlGenerator         = sqlGenerator;
        }
Exemplo n.º 21
0
        protected ReaderModificationCommandBatch(
            [NotNull] IRelationalCommandBuilderFactory commandBuilderFactory,
            [NotNull] IUpdateSqlGenerator sqlGenerator)
        {
            Check.NotNull(commandBuilderFactory, nameof(commandBuilderFactory));
            Check.NotNull(sqlGenerator, nameof(sqlGenerator));

            _commandBuilderFactory = commandBuilderFactory;
            UpdateSqlGenerator     = sqlGenerator;
        }
Exemplo n.º 22
0
 public ModificationCommandBatchFake(
     IUpdateSqlGenerator sqlGenerator         = null,
     IRelationalCommandBuilderFactory factory = null)
     : base(
         factory ?? new FakeCommandBuilderFactory(),
         new RelationalSqlGenerationHelper(),
         sqlGenerator ?? new FakeSqlGenerator(),
         new TypedRelationalValueBufferFactoryFactory())
 {
     ShouldAddCommand  = true;
     ShouldValidateSql = true;
 }
        public SqliteModificationCommandBatchFactory(
            [NotNull] IRelationalCommandBuilderFactory commandBuilderFactory,
            [NotNull] IUpdateSqlGenerator updateSqlGenerator,
            [NotNull] IRelationalValueBufferFactoryFactory valueBufferFactoryFactory)
        {
            Check.NotNull(commandBuilderFactory, nameof(commandBuilderFactory));
            Check.NotNull(updateSqlGenerator, nameof(updateSqlGenerator));
            Check.NotNull(valueBufferFactoryFactory, nameof(valueBufferFactoryFactory));

            _commandBuilderFactory = commandBuilderFactory;
            _updateSqlGenerator = updateSqlGenerator;
            _valueBufferFactoryFactory = valueBufferFactoryFactory;
        }
        protected MigrationsSqlGenerator(
            [NotNull] IUpdateSqlGenerator sql,
            [NotNull] IRelationalTypeMapper typeMapper,
            [NotNull] IRelationalMetadataExtensionProvider annotations)
        {
            Check.NotNull(sql, nameof(sql));
            Check.NotNull(typeMapper, nameof(typeMapper));
            Check.NotNull(annotations, nameof(annotations));

            Sql          = sql;
            _typeMapper  = typeMapper;
            _annotations = annotations;
        }
Exemplo n.º 25
0
        public SqliteModificationCommandBatchFactory(
            [NotNull] IRelationalCommandBuilderFactory commandBuilderFactory,
            [NotNull] IUpdateSqlGenerator updateSqlGenerator,
            [NotNull] IRelationalValueBufferFactoryFactory valueBufferFactoryFactory)
        {
            Check.NotNull(commandBuilderFactory, nameof(commandBuilderFactory));
            Check.NotNull(updateSqlGenerator, nameof(updateSqlGenerator));
            Check.NotNull(valueBufferFactoryFactory, nameof(valueBufferFactoryFactory));

            _commandBuilderFactory     = commandBuilderFactory;
            _updateSqlGenerator        = updateSqlGenerator;
            _valueBufferFactoryFactory = valueBufferFactoryFactory;
        }
 /// <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 NpgsqlSequenceHiLoValueGenerator(
     [NotNull] IRawSqlCommandBuilder rawSqlCommandBuilder,
     [NotNull] IUpdateSqlGenerator sqlGenerator,
     [NotNull] NpgsqlSequenceValueGeneratorState generatorState,
     [NotNull] INpgsqlRelationalConnection connection,
     [NotNull] IDiagnosticsLogger <DbLoggerCategory.Database.Command> commandLogger)
     : base(generatorState)
 {
     _sequence             = generatorState.Sequence;
     _rawSqlCommandBuilder = rawSqlCommandBuilder;
     _sqlGenerator         = sqlGenerator;
     _connection           = connection;
     _commandLogger        = commandLogger;
 }
 /// <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 NpgsqlSequenceHiLoValueGenerator(
     IRawSqlCommandBuilder rawSqlCommandBuilder,
     IUpdateSqlGenerator sqlGenerator,
     NpgsqlSequenceValueGeneratorState generatorState,
     INpgsqlRelationalConnection connection,
     IRelationalCommandDiagnosticsLogger commandLogger)
     : base(generatorState)
 {
     _sequence             = generatorState.Sequence;
     _rawSqlCommandBuilder = rawSqlCommandBuilder;
     _sqlGenerator         = sqlGenerator;
     _connection           = connection;
     _commandLogger        = commandLogger;
 }
 public ModificationCommandBatchFake(
     IUpdateSqlGenerator sqlGenerator = null)
     : base(
         new RelationalCommandBuilderFactory(
             new FakeSensitiveDataLogger <RelationalCommandBuilderFactory>(),
             new DiagnosticListener("Fake"),
             new FakeRelationalTypeMapper()),
         new RelationalSqlGenerationHelper(),
         sqlGenerator ?? new FakeSqlGenerator(),
         new TypedRelationalValueBufferFactoryFactory())
 {
     ShouldAddCommand  = true;
     ShouldValidateSql = true;
 }
 public ModificationCommandBatchFake(
     IUpdateSqlGenerator sqlGenerator = null)
     : base(
         new RelationalCommandBuilderFactory(
             new FakeInterceptingLogger <LoggerCategory.Database.Sql>(),
             new DiagnosticListener("Fake"),
             new FakeRelationalTypeMapper(new RelationalTypeMapperDependencies())),
         new RelationalSqlGenerationHelper(new RelationalSqlGenerationHelperDependencies()),
         sqlGenerator ?? new FakeSqlGenerator(),
         new TypedRelationalValueBufferFactoryFactory(new RelationalValueBufferFactoryDependencies()))
 {
     ShouldAddCommand  = true;
     ShouldValidateSql = true;
 }
Exemplo n.º 30
0
 public ModificationCommandBatchFake(
     IUpdateSqlGenerator sqlGenerator = null)
     : base(
         new RelationalCommandBuilderFactory(
             new FakeDiagnosticsLogger <DbLoggerCategory.Database.Command>(),
             new FakeRelationalTypeMapper(new RelationalTypeMapperDependencies())),
         new RelationalSqlGenerationHelper(new RelationalSqlGenerationHelperDependencies()),
         sqlGenerator ?? new FakeSqlGenerator(
             RelationalTestHelpers.Instance.CreateContextServices().GetRequiredService <UpdateSqlGeneratorDependencies>()),
         new TypedRelationalValueBufferFactoryFactory(new RelationalValueBufferFactoryDependencies()))
 {
     ShouldAddCommand  = true;
     ShouldValidateSql = true;
 }
Exemplo n.º 31
0
 public OracleModificationCommandBatch(
     [NotNull] IRelationalCommandBuilderFactory commandBuilderFactory,
     [NotNull] ISqlGenerationHelper sqlGenerationHelper,
     [NotNull] IUpdateSqlGenerator updateSqlGenerator,
     [NotNull] IRelationalValueBufferFactoryFactory valueBufferFactoryFactory,
     int?maxBatchSize)
     : base(commandBuilderFactory, sqlGenerationHelper, updateSqlGenerator, valueBufferFactoryFactory)
 {
     _commandBuilderFactory = commandBuilderFactory;
     _batchInsertCommands   = new List <ModificationCommand>();
     _variablesInsert       = new Dictionary <string, string>();
     _variablesCommand      = new StringBuilder();
     _maxBatchSize          = Math.Min(maxBatchSize ?? int.MaxValue, MaxRowCount);
 }
Exemplo n.º 32
0
        public HistoryRepository(
            [NotNull] IDatabaseCreator databaseCreator,
            [NotNull] ISqlStatementExecutor executor,
            [NotNull] IRelationalConnection connection,
            [NotNull] IDbContextOptions options,
            [NotNull] IMigrationsModelDiffer modelDiffer,
            [NotNull] IMigrationsSqlGenerator migrationsSqlGenerator,
            [NotNull] IRelationalMetadataExtensionProvider annotations,
            [NotNull] IUpdateSqlGenerator sql)
        {
            Check.NotNull(databaseCreator, nameof(databaseCreator));
            Check.NotNull(executor, nameof(executor));
            Check.NotNull(connection, nameof(connection));
            Check.NotNull(options, nameof(options));
            Check.NotNull(modelDiffer, nameof(modelDiffer));
            Check.NotNull(migrationsSqlGenerator, nameof(migrationsSqlGenerator));
            Check.NotNull(annotations, nameof(annotations));
            Check.NotNull(sql, nameof(sql));

            _databaseCreator        = (IRelationalDatabaseCreator)databaseCreator;
            _executor               = executor;
            _connection             = connection;
            _modelDiffer            = modelDiffer;
            _migrationsSqlGenerator = migrationsSqlGenerator;
            Sql = sql;

            var relationalOptions = RelationalOptionsExtension.Extract(options);

            TableName   = relationalOptions?.MigrationsHistoryTableName ?? DefaultTableName;
            TableSchema = relationalOptions.MigrationsHistoryTableSchema;
            _model      = new LazyRef <IModel>(
                () =>
            {
                var modelBuilder = new ModelBuilder(new ConventionSet());
                modelBuilder.Entity <HistoryRow>(
                    x =>
                {
                    ConfigureTable(x);
                    x.ToTable(TableName, TableSchema);
                });

                return(modelBuilder.Model);
            });
            var entityType = new LazyRef <IEntityType>(() => _model.Value.GetEntityType(typeof(HistoryRow)));

            _migrationIdColumnName = new LazyRef <string>(
                () => annotations.For(entityType.Value.FindProperty(nameof(HistoryRow.MigrationId))).ColumnName);
            _productVersionColumnName = new LazyRef <string>(
                () => annotations.For(entityType.Value.FindProperty(nameof(HistoryRow.ProductVersion))).ColumnName);
        }
 public TestModificationCommandBatchFactory(
     IUpdateSqlGenerator sqlGenerator)
     : base(sqlGenerator)
 {
 }
 public ModificationCommandBatchFake(IUpdateSqlGenerator sqlGenerator = null)
     : base(sqlGenerator ?? new FakeSqlGenerator())
 {
     ShouldAddCommand = true;
     ShouldValidateSql = true;
 }
 public ModificationCommandBatchFake(DbDataReader reader, IUpdateSqlGenerator sqlGenerator = null)
     : base(sqlGenerator ?? new FakeSqlGenerator())
 {
     _reader = reader;
     ShouldAddCommand = true;
     ShouldValidateSql = true;
 }
 public ModificationCommandBatchFake(DbDataReader reader, IUpdateSqlGenerator sqlGenerator = null)
     : base(
           new RelationalCommandBuilderFactory(new ConcreteTypeMapper()),
           sqlGenerator ?? new FakeSqlGenerator(),
           new TypedRelationalValueBufferFactoryFactory())
 {
     _reader = reader;
     ShouldAddCommand = true;
     ShouldValidateSql = true;
 }
 public ConcreteMigrationSqlGenerator(
     IUpdateSqlGenerator sqlGenerator,
     IRelationalTypeMapper typeMapper,
     IRelationalMetadataExtensionProvider annotations)
     : base(sqlGenerator, typeMapper, annotations)
 {
 }
 public ModificationCommandBatchFake(
     IUpdateSqlGenerator sqlGenerator = null)
     : base(
         new RelationalCommandBuilderFactory(
             new FakeSensitiveDataLogger<RelationalCommandBuilderFactory>(),
             new DiagnosticListener("Fake"),
             new FakeRelationalTypeMapper()),
         new RelationalSqlGenerationHelper(),
         sqlGenerator ?? new FakeSqlGenerator(),
         new TypedRelationalValueBufferFactoryFactory())
 {
     ShouldAddCommand = true;
     ShouldValidateSql = true;
 }
        protected MigrationSqlGenerator([NotNull] IUpdateSqlGenerator sqlGenerator)
        {
            Check.NotNull(sqlGenerator, nameof(sqlGenerator));

            _sql = sqlGenerator;
        }
 public TestModificationCommandBatchFactory(
     IRelationalCommandBuilderFactory commandBuilderfactory,
     ISqlGenerationHelper sqlGenerationHelper,
     IUpdateSqlGenerator updateSqlGenerator,
     IRelationalValueBufferFactoryFactory valueBufferFactoryFactory)
 {
     _commandBuilderFactory = commandBuilderfactory;
     _sqlGenerationHelper = sqlGenerationHelper;
     _updateSqlGenerator = updateSqlGenerator;
     _valueBufferFactoryFactory = valueBufferFactoryFactory;
 }
 public SqliteMigrationSqlGenerator([NotNull] IUpdateSqlGenerator sqlGenerator)
     : base(sqlGenerator)
 {
     _sql = sqlGenerator;
 }
 public ModificationCommandBatchFake(
     IUpdateSqlGenerator sqlGenerator = null,
     IRelationalCommandBuilderFactory factory = null)
     : base(
         factory ?? new FakeCommandBuilderFactory(),
         new RelationalSqlGenerator(),
         sqlGenerator ?? new FakeSqlGenerator(),
         new TypedRelationalValueBufferFactoryFactory())
 {
     ShouldAddCommand = true;
     ShouldValidateSql = true;
 }