public static IServiceCollection AddPostgresData(this IServiceCollection services, Action <PostgresOptions>?options = null) { var postgresOptions = new PostgresOptions(); options?.Invoke(postgresOptions); services.TryAddSingleton <IPostgresConnection>(_ => new PostgresConnection(postgresOptions)); return(services); }
public PostgresConnection(PostgresOptions options) { _options = options ?? throw new ArgumentNullException(nameof(options)); }