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);
        }
示例#2
0
        public void Setup()
        {
            var quoter = new PostgresQuoter(new OptionsWrapper <QuoterOptions>(new QuoterOptions()), new PostgresOptions());

            Generator = new PostgresGenerator(quoter)
            {
                CompatibilityMode = Runner.CompatibilityMode.STRICT,
            };
        }
 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)
 {
 }
示例#4
0
        public IProcessor Create(ProcessorOptions options, ILogger logger)
        {
            var postgresOptions = new PostgresOptions {
                ForceQuote = true
            };
            var quoter           = new PostgresQuoter(postgresOptions);
            var generatorOptions = new GeneratorOptions();
            var generator        = new PostgresGenerator(quoter, generatorOptions, new PostgresTypeMap());

            return(new PostgresProcessor(generator, logger, options, postgresOptions));
        }
示例#5
0
 public PostgresProcessor(PostgresGenerator generator,
                          ILogger logger,
                          ProcessorOptions options,
                          PostgresOptions pgOptions)
     : base(() => NpgsqlFactory.Instance, generator, logger, options)
 {
     if (pgOptions == null)
     {
         throw new ArgumentNullException(nameof(pgOptions));
     }
     _quoter = new PostgresQuoter(pgOptions);
 }
示例#6
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);
        }
        public ExtendedPostgresProcessor(
            IDbConfig dbConfig,
            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;
            DbConfig = dbConfig;

            if (dbConfig.DbType.GetProcessorId() == ProcessorIds.PostgresProcessorId)
            {
                PostgresDatabaseCreator.CreateDatabase(dbConfig);
            }

            this.SetPrivateFieldValue <PostgresProcessor>("_quoter", quoter);
        }
 public void Setup()
 {
     Generator = new PostgresGenerator();
 }
示例#9
0
        public void Setup()
        {
            var quoter = new PostgresQuoter(new PostgresOptions());

            Generator = new PostgresGenerator(quoter);
        }
 public PostgresGeneratorTests()
 {
     generator = new PostgresGenerator();
 }
        public void Setup()
        {
            var quoter = new PostgresQuoter(new OptionsWrapper <QuoterOptions>(new QuoterOptions()), new PostgresOptions());

            Generator = new PostgresGenerator(quoter);
        }
 public PostgresGeneratorTests()
 {
     generator = new PostgresGenerator();
 }
 public void SetUp()
 {
     generator = new PostgresGenerator();
 }
示例#14
0
        public void Setup()
        {
            var quoter = new PostgresQuoter(new PostgresOptions());

            Generator = new Postgres92Generator(quoter, new OptionsWrapper <GeneratorOptions>(new GeneratorOptions()));
        }