예제 #1
0
        public JetProcessor(
            [NotNull] JetGenerator generator,
            [NotNull] ILogger <JetProcessor> logger,
            [NotNull] IOptionsSnapshot <ProcessorOptions> options,
            [NotNull] IConnectionStringAccessor connectionStringAccessor)
            : base(generator, logger, options.Value)
        {
            var factory          = OleDbFactory.Instance;
            var connectionString = connectionStringAccessor.ConnectionString ?? options.Value.ConnectionString;

            if (factory != null)
            {
                _connection = new Lazy <OleDbConnection>(
                    () =>
                {
                    var conn = (OleDbConnection)factory.CreateConnection();
                    Debug.Assert(conn != null, nameof(conn) + " != null");
                    conn.ConnectionString = connectionString;
                    return(conn);
                });
            }

#pragma warning disable 612
            ConnectionString = connectionString;
#pragma warning restore 612
        }
예제 #2
0
        public ExtendedOracleProcessorBase(OracleBaseDbFactory factory,
                                           IMigrationGenerator generator,
                                           ILogger logger,
                                           IOptionsSnapshot <ProcessorOptions> options,
                                           IOptionsSnapshot <RunnerOptions> runnerOptions,
                                           IConnectionStringAccessor connectionStringAccessor,
                                           IExtendedMigrationGenerator <ExtendedOracleMigrationGenerator> extendedGenerator,
                                           IDbMigrationConfig migrationConfig,
                                           IMigrationSourceItem migrationSourceItem   = null,
                                           IVersionTableMetaData versionTableMetaData = null,
                                           IOptions <FluentMigratorLoggerOptions> loggerGenOptions      = null,
                                           IOptions <LogFileFluentMigratorLoggerOptions> logFileOptions = null) : base(ProcessorIds.OracleProcessorId, factory, generator, logger, options, connectionStringAccessor)
        {
            RunnerOptions        = runnerOptions;
            MigrationConfig      = migrationConfig;
            VersionTableMetaData = versionTableMetaData;
            LoggerOptions        = loggerGenOptions?.Value;
            LoggerFileOptions    = logFileOptions?.Value;

            IsSqlLogEnabled = (LoggerOptions?.ShowSql ?? false) || (LoggerFileOptions?.ShowSql ?? false);

            ExtendedGenerator = extendedGenerator;
            MigrationMetadata = new MigrationMetadata(migrationSourceItem).InitMetadata(MigrationConfig);

            ConnectionStringFunc = () => connectionStringAccessor.ConnectionString;
            Initialize();
        }
        public ExtendedPostgresProcessor(IDbMigrationConfig dbMigrationConfig,
                                         PostgresQuoter quoter,
                                         PostgresDbFactory factory,
                                         PostgresGenerator generator,
                                         ILogger <ExtendedPostgresProcessor> logger,
                                         IOptionsSnapshot <ProcessorOptions> options,
                                         IConnectionStringAccessor connectionStringAccessor,
                                         IExtendedMigrationGenerator <ExtendedPostgresGenerator> extendedGenerator)
            : base(factory, generator, logger, options, connectionStringAccessor)
        {
            ExtendedGeneratorField = extendedGenerator;
            DbMigrationConfig      = dbMigrationConfig;

            if (dbMigrationConfig.ProcessorId == ProcessorIds.PostgresProcessorId)
            {
                var stopWatch = new StopWatch();

                PostgresDatabaseCreator.CreateDatabase(
                    dbMigrationConfig,
                    () =>
                {
                    Logger.LogSay($"Creating Postgres database '{dbMigrationConfig.DatabaseName.ToLower()}'...");
                    stopWatch.Start();
                },
                    sql =>
                {
                    stopWatch.Stop();
                    Logger.LogSql(sql);
                    Logger.LogSay($"Created Postgres database '{dbMigrationConfig.DatabaseName.ToLower()}'...");
                    Logger.LogElapsedTime(stopWatch.ElapsedTime());
                });
            }

            this.SetPrivateFieldValue <PostgresProcessor>("_quoter", quoter);
        }
예제 #4
0
 public NzbDroneSQLiteProcessor(SQLiteDbFactory factory,
                                SQLiteGenerator generator,
                                ILogger <NzbDroneSQLiteProcessor> logger,
                                IOptionsSnapshot <ProcessorOptions> options,
                                IConnectionStringAccessor connectionStringAccessor,
                                IServiceProvider serviceProvider)
     : base(factory, generator, logger, options, connectionStringAccessor, serviceProvider)
 {
 }
예제 #5
0
 public ExtendedOracleProcessorBase(OracleBaseDbFactory factory,
                                    IMigrationGenerator generator,
                                    ILogger logger,
                                    IOptionsSnapshot <ProcessorOptions> options,
                                    IConnectionStringAccessor connectionStringAccessor,
                                    IExtendedMigrationGenerator <ExtendedOracleMigrationGenerator> extendedGenerator) : base(ProcessorIds.OracleProcessorId, factory, generator, logger, options, connectionStringAccessor)
 {
     ExtendedGenerator = extendedGenerator;
 }
예제 #6
0
 public RedshiftProcessor(
     [NotNull] RedshiftDbFactory factory,
     [NotNull] RedshiftGenerator generator,
     [NotNull] ILogger <RedshiftProcessor> logger,
     [NotNull] IOptions <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor)
     : base(() => factory.Factory, generator, logger, options.Value, connectionStringAccessor)
 {
 }
 public DotConnectOracleProcessor(
     [NotNull] DotConnectOracleDbFactory factory,
     [NotNull] IOracleGenerator generator,
     [NotNull] ILogger <DotConnectOracleProcessor> logger,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor)
     : base(() => factory.Factory, generator, logger, options.Value, connectionStringAccessor)
 {
 }
예제 #8
0
 /// <inheritdoc />
 public Processor(
     DbProviderFactory factory,
     [NotNull] ILogger logger,
     [NotNull] SqlServer2000Generator generator,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor)
     : base(factory, logger, generator, options, connectionStringAccessor, new SqlServerBatchParserFactory(null))
 {
 }
예제 #9
0
 public HanaProcessor(
     [NotNull] HanaDbFactory factory,
     [NotNull] HanaGenerator generator,
     [NotNull] ILogger <HanaProcessor> logger,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor)
     : base(() => factory.Factory, generator, logger, options.Value, connectionStringAccessor)
 {
 }
예제 #10
0
 public PostgresProcessor(
     [NotNull] PostgresDbFactory factory,
     [NotNull] PostgresGenerator generator,
     [NotNull] ILogger <PostgresProcessor> logger,
     [NotNull] IOptions <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor)
     : base(() => factory.Factory, generator, logger, options.Value, connectionStringAccessor)
 {
 }
 public OracleManagedProcessor(
     [NotNull] OracleManagedDbFactory factory,
     [NotNull] OracleGenerator generator,
     [NotNull] ILogger <OracleManagedProcessor> logger,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor)
     : base("OracleManaged", factory, generator, logger, options, connectionStringAccessor)
 {
 }
 public SqlServer2000Processor(
     [NotNull] ILogger <SqlServer2000Processor> logger,
     [NotNull] SqlServer2000Generator generator,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor,
     [NotNull] IServiceProvider serviceProvider)
     : this(SqlClientFactory.Instance, logger, generator, options, connectionStringAccessor, serviceProvider)
 {
 }
예제 #13
0
 protected MySqlProcessor(
     [NotNull] MySqlDbFactory factory,
     [NotNull] IMigrationGenerator generator,
     [NotNull] ILogger <MySqlProcessor> logger,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor)
     : base(() => factory.Factory, generator, logger, options.Value, connectionStringAccessor)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SqlServer2005Processor"/> class.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="quoter">The quoter.</param>
 /// <param name="generator">The migration generator.</param>
 /// <param name="options">The processor options.</param>
 /// <param name="connectionStringAccessor">The connection string accessor.</param>
 /// <param name="batchParserFactory"></param>
 public SqlServer2005Processor(
     [NotNull] ILogger <SqlServer2005Processor> logger,
     [NotNull] SqlServer2005Quoter quoter,
     [NotNull] SqlServer2005Generator generator,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor,
     [NotNull] SqlServerBatchParserFactory batchParserFactory)
     : base(new[] { "SqlServer2005", "SqlServer" }, SqlClientFactory.Instance, generator, quoter, logger, options, connectionStringAccessor, batchParserFactory)
 {
 }
예제 #15
0
 public Postgres92Processor(
     [NotNull] PostgresDbFactory factory,
     [NotNull] Postgres92Generator generator,
     [NotNull] ILogger <PostgresProcessor> logger,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor,
     [NotNull] PostgresOptions pgOptions)
     : base(factory, generator, logger, options, connectionStringAccessor, pgOptions)
 {
 }
 public SqlServer2005Processor(
     [NotNull] ILogger <SqlServer2005Processor> logger,
     [NotNull] SqlServer2005Quoter quoter,
     [NotNull] SqlServer2005Generator generator,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor,
     [NotNull] IServiceProvider serviceProvider)
     : base(new[] { "SqlServer2005", "SqlServer" }, generator, quoter, logger, options, connectionStringAccessor, serviceProvider)
 {
 }
예제 #17
0
 protected SqlServerProcessor(
     [NotNull, ItemNotNull] IEnumerable <string> databaseTypes,
     [NotNull] IMigrationGenerator generator,
     [NotNull] IQuoter quoter,
     [NotNull] ILogger logger,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor,
     [NotNull] IServiceProvider serviceProvider)
     : this(databaseTypes, SqlClientFactory.Instance, generator, quoter, logger, options, connectionStringAccessor, serviceProvider)
 {
 }
예제 #18
0
 public ExtendedOracleProcessorBase(
     IDbConfig dbConfig,
     OracleBaseDbFactory factory,
     IMigrationGenerator generator,
     ILogger logger,
     IOptionsSnapshot <ProcessorOptions> options,
     IConnectionStringAccessor connectionStringAccessor,
     IExtendedMigrationGenerator <ExtendedOracleMigrationGenerator> extendedGenerator) : base(dbConfig.DbType.GetProcessorId(), factory, generator, logger, options, connectionStringAccessor)
 {
     ExtendedGenerator = extendedGenerator;
 }
예제 #19
0
 public Db2Processor(
     [NotNull] Db2DbFactory factory,
     [NotNull] Db2Generator generator,
     [NotNull] Db2Quoter quoter,
     [NotNull] ILogger <Db2Processor> logger,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor)
     : base(() => factory.Factory, generator, logger, options.Value, connectionStringAccessor)
 {
     Quoter = quoter;
 }
예제 #20
0
 public SQLiteProcessor(
     [NotNull] SQLiteDbFactory factory,
     [NotNull] SQLiteGenerator generator,
     [NotNull] ILogger <SQLiteProcessor> logger,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor,
     [NotNull] IServiceProvider serviceProvider)
     : base(() => factory.Factory, generator, logger, options.Value, connectionStringAccessor)
 {
     _serviceProvider = serviceProvider;
 }
예제 #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SQLiteProcessor"/> class.
 /// </summary>
 /// <param name="factory">The SQLite DB factory.</param>
 /// <param name="generator">The migration generator.</param>
 /// <param name="logger">The logger.</param>
 /// <param name="options">The options.</param>
 /// <param name="connectionStringAccessor">The connection string accessor.</param>
 /// <param name="batchParserFactory">The batch parser factory.</param>
 public SQLiteProcessor(
     [NotNull] SQLiteDbFactory factory,
     [NotNull] SQLiteGenerator generator,
     [NotNull] ILogger <SQLiteProcessor> logger,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor,
     [NotNull] SQLiteBatchParserFactory batchParserFactory)
     : base(() => factory.Factory, generator, logger, options.Value, connectionStringAccessor)
 {
     _batchParserFactory = batchParserFactory;
 }
 protected SqlServer2000Processor(
     DbProviderFactory factory,
     [NotNull] ILogger logger,
     [NotNull] SqlServer2000Generator generator,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor,
     [NotNull] IServiceProvider serviceProvider)
     : base(() => factory, generator, logger, options.Value, connectionStringAccessor)
 {
     _serviceProvider = serviceProvider;
 }
예제 #23
0
 protected OracleProcessorBase(
     [NotNull] string databaseType,
     [NotNull] OracleBaseDbFactory factory,
     [NotNull] IMigrationGenerator generator,
     [NotNull] ILogger logger,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor)
     : base(() => factory.Factory, generator, logger, options.Value, connectionStringAccessor)
 {
     DatabaseType = databaseType;
 }
예제 #24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SqlServer2000Processor"/> class.
 /// </summary>
 /// <param name="factory">The DB provider factory.</param>
 /// <param name="logger">The logger.</param>
 /// <param name="generator">The migration generator.</param>
 /// <param name="options">The processor options.</param>
 /// <param name="connectionStringAccessor">The connection string accessor.</param>
 /// <param name="sqlBatchParserFactory">The factory for the SQL batch parser.</param>
 protected SqlServer2000Processor(
     [NotNull] DbProviderFactory factory,
     [NotNull] ILogger logger,
     [NotNull] SqlServer2000Generator generator,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor,
     [NotNull] ISqlBatchParserFactory sqlBatchParserFactory)
     : base(() => factory, generator, logger, options.Value, connectionStringAccessor)
 {
     _sqlBatchParserFactory = sqlBatchParserFactory;
 }
 public ExtendedOracleManagedProcessor(
     OracleManagedDbFactory factory,
     OracleGenerator generator,
     ILogger <ExtendedOracleManagedProcessor> logger,
     IOptionsSnapshot <ProcessorOptions> options,
     IConnectionStringAccessor connectionStringAccessor,
     IExtendedMigrationProcessor <ExtendedOracleProcessorBase> extendedMigrationProcessor
     )
     : base(factory, generator, logger, options, connectionStringAccessor)
 {
     ExtendedMigrationProcessor = extendedMigrationProcessor;
 }
예제 #26
0
 public SQLiteProcessor(
     [NotNull] SQLiteDbFactory factory,
     [NotNull] SQLiteGenerator generator,
     [NotNull] ILogger <SQLiteProcessor> logger,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor,
     [NotNull] IServiceProvider serviceProvider)
     : base(() => factory.Factory, generator, logger, options.Value, connectionStringAccessor)
 {
     _batchParserFactory = serviceProvider.GetService <SQLiteBatchParserFactory>()
                           ?? new SQLiteBatchParserFactory(serviceProvider);
 }
예제 #27
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="logger"></param>
 /// <param name="generator"></param>
 /// <param name="options"></param>
 /// <param name="connectionStringAccessor"></param>
 /// <param name="factory"></param>
 /// <param name="quoter"></param>
 /// <param name="serviceProvider"></param>
 public SybaseAseProcessor(
     [NotNull] ILogger <SybaseAseProcessor> logger,
     [NotNull] SybaseAse2000Generator generator,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor,
     [NotNull] SybaseAseDbFactory factory,
     [NotNull] IQuoter quoter,
     [NotNull] IServiceProvider serviceProvider)
     : base(() => factory.Factory, generator, logger, options?.Value, connectionStringAccessor)
 {
     _serviceProvider = serviceProvider;
     Quoter           = quoter;
 }
예제 #28
0
 protected SqlAnywhereProcessor(
     [NotNull] string databaseType,
     [NotNull] Func <DbProviderFactory> factoryAccessor,
     [NotNull] IMigrationGenerator generator,
     [NotNull] ILogger logger,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor,
     [NotNull] IServiceProvider serviceProvider)
     : base(factoryAccessor, generator, logger, options.Value, connectionStringAccessor)
 {
     _serviceProvider = serviceProvider;
     DatabaseType     = databaseType;
 }
 /// <inheritdoc />
 public MySql4Processor(
     [NotNull] MySqlDbFactory factory,
     [NotNull] MySql4Generator generator,
     [NotNull] ILogger <MySql4Processor> logger,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor) : base(
         factory,
         generator,
         logger,
         options,
         connectionStringAccessor)
 {
 }
예제 #30
0
        public PostgresProcessor(
            [NotNull] PostgresDbFactory factory,
            [NotNull] PostgresGenerator generator,
            [NotNull] ILogger <PostgresProcessor> logger,
            [NotNull] IOptionsSnapshot <ProcessorOptions> options,
            [NotNull] IConnectionStringAccessor connectionStringAccessor,
            [NotNull] PostgresOptions pgOptions)
            : base(() => factory.Factory, generator, logger, options.Value, connectionStringAccessor)
        {
            if (pgOptions == null)
            {
                throw new ArgumentNullException(nameof(pgOptions));
            }

            _quoter = new PostgresQuoter(pgOptions);
        }