Ejemplo n.º 1
0
        private Connection GetConnection(PostgresServiceInfo info, IConfiguration configuration)
        {
            var postgresConfig = new PostgresProviderConnectorOptions(configuration);
            var configurer     = new PostgresProviderConfigurer();
            var connection     = new Connection(configurer.Configure(info, postgresConfig), "Postgres", info);

            connection.Properties.Add("ClientCertificate", postgresConfig.ClientCertificate);
            connection.Properties.Add("ClientKey", postgresConfig.ClientKey);
            connection.Properties.Add("SslRootCertificate", postgresConfig.SslRootCertificate);

            return(connection);
        }
Ejemplo n.º 2
0
        public Connection Get(IConfiguration configuration, string serviceName)
        {
            var info = serviceName == null
             ? configuration.GetSingletonServiceInfo <PostgresServiceInfo>()
             : configuration.GetRequiredServiceInfo <PostgresServiceInfo>(serviceName);

            var postgresConfig = new PostgresProviderConnectorOptions(configuration);
            var configurer     = new PostgresProviderConfigurer();

            return(new Connection
            {
                ConnectionString = configurer.Configure(info, postgresConfig),
                Name = "Postgres" + serviceName?.Insert(0, "-")
            });
        }
Ejemplo n.º 3
0
        public Connection Get(IConfiguration configuration, string serviceName)
        {
            var info = serviceName == null
             ? configuration.GetSingletonServiceInfo <PostgresServiceInfo>()
             : configuration.GetRequiredServiceInfo <PostgresServiceInfo>(serviceName);

            var postgresConfig = new PostgresProviderConnectorOptions(configuration);
            var configurer     = new PostgresProviderConfigurer();

            var connectionString = configurer.Configure(info, postgresConfig);

            ClientCertificate  = postgresConfig.ClientCertificate;
            ClientKey          = postgresConfig.ClientKey;
            SslRootCertificate = postgresConfig.SslRootCertificate;

            ConnectionString = connectionString;
            Name             = "Postgres" + serviceName?.Insert(0, "-");

            return(this);
        }