Exemplo n.º 1
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));
        }
Exemplo n.º 2
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);
 }
Exemplo n.º 3
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);
        }