private static void DoAdd(IServiceCollection services, PostgresServiceInfo info, IConfiguration config, ServiceLifetime contextLifetime) { PostgresProviderConnectorOptions PostgresConfig = new PostgresProviderConnectorOptions(config); PostgresProviderConnectorFactory factory = new PostgresProviderConnectorFactory(info, PostgresConfig); services.Add(new ServiceDescriptor(typeof(NpgsqlConnection), factory.Create, contextLifetime)); }
private static void DoAdd(IServiceCollection services, PostgresServiceInfo info, IConfiguration config, ServiceLifetime contextLifetime) { var postgresConfig = new PostgresProviderConnectorOptions(config); var factory = new PostgresProviderConnectorFactory(info, postgresConfig, PostgreSqlTypeLocator.NpgsqlConnection); services.Add(new ServiceDescriptor(typeof(IHealthContributor), ctx => new RelationalHealthContributor((IDbConnection)factory.Create(ctx), ctx.GetService <ILogger <RelationalHealthContributor> >()), contextLifetime)); }
private static void DoAdd(IServiceCollection services, PostgresServiceInfo info, IConfiguration config, ServiceLifetime contextLifetime) { Type postgresConnection = ConnectorHelpers.FindType(PostgreSqlTypeLocator.Assemblies, PostgreSqlTypeLocator.ConnectionTypeNames); var postgresConfig = new PostgresProviderConnectorOptions(config); var factory = new PostgresProviderConnectorFactory(info, postgresConfig, postgresConnection); services.Add(new ServiceDescriptor(typeof(IDbConnection), factory.Create, contextLifetime)); services.Add(new ServiceDescriptor(postgresConnection, factory.Create, contextLifetime)); services.Add(new ServiceDescriptor(typeof(IHealthContributor), ctx => new RelationalHealthContributor((IDbConnection)factory.Create(ctx), ctx.GetService <ILogger <RelationalHealthContributor> >()), ServiceLifetime.Singleton)); }
private static void DoAdd(IServiceCollection services, PostgresServiceInfo info, IConfiguration config, ServiceLifetime contextLifetime) { Type postgresConnection = ConnectorHelpers.FindType(postgresAssemblies, postgresTypeNames); if (postgresConnection == null) { throw new ConnectorException("Unable to find NpgsqlConnection, are you missing Postgres ADO.NET assembly"); } PostgresProviderConnectorOptions postgresConfig = new PostgresProviderConnectorOptions(config); PostgresProviderConnectorFactory factory = new PostgresProviderConnectorFactory(info, postgresConfig, postgresConnection); services.Add(new ServiceDescriptor(typeof(IDbConnection), factory.Create, contextLifetime)); services.Add(new ServiceDescriptor(postgresConnection, factory.Create, contextLifetime)); }