public override IMigrationProcessor Create(string connectionString, IAnnouncer announcer, IMigrationProcessorOptions options)
        {
            var optionsParsed = PostgresOptions.ParseProviderSwitches(options.ProviderSwitches);
            var factory       = new PostgresDbFactory(_serviceProvider);
            var connection    = factory.CreateConnection(connectionString);

            return(new PostgresProcessor(connection, new PostgresGenerator(new PostgresQuoter(optionsParsed)), announcer, options, factory, optionsParsed));
        }
Ejemplo n.º 2
0
 public Postgres10_0Processor(
     [NotNull] PostgresDbFactory factory,
     [NotNull] Postgres10_0Generator generator,
     [NotNull] ILogger <PostgresProcessor> logger,
     [NotNull] IOptionsSnapshot <ProcessorOptions> options,
     [NotNull] IConnectionStringAccessor connectionStringAccessor,
     [NotNull] PostgresOptions pgOptions)
     : base(factory, generator, logger, options, connectionStringAccessor, pgOptions)
 {
 }
Ejemplo n.º 3
0
        public PostgresProcessor(IDbConnection connection, IMigrationGenerator generator, IAnnouncer announcer, IMigrationProcessorOptions options, IDbFactory factory,
                                 [NotNull] PostgresOptions pgOptions)
            : base(connection, factory, generator, announcer, options)
        {
            if (pgOptions == null)
            {
                throw new ArgumentNullException(nameof(pgOptions));
            }

            _quoter = new PostgresQuoter(pgOptions);
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
0
        public static PostgresOptions ParseProviderSwitches(string providerSwitches)
        {
            var retval = new PostgresOptions();

            var switchesParsed = Regex.Matches(providerSwitches ?? string.Empty, @"(?<key>[^=]+)=(?<value>[^\s]+)");

            foreach (Match match in switchesParsed)
            {
                if (!match.Success)
                {
                    continue;
                }

                var key   = match.Groups["key"].Value;
                var value = match.Groups["value"].Value;

                if ("Force Quote".Equals(key, StringComparison.OrdinalIgnoreCase) && bool.TryParse(value, out var forceQuoteParsed))
                {
                    retval.ForceQuote = forceQuoteParsed;
                }
            }

            return(retval);
        }