Exemple #1
0
        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);
        }
Exemple #2
0
 public PostgresConnection(PostgresOptions options)
 {
     _options = options ?? throw new ArgumentNullException(nameof(options));
 }