Method UsePostgreSqlStorage
- Namespace
- Millrace
- Assembly
- Millrace.Storage.PostgreSql.dll
UsePostgreSqlStorage(MillraceBuilder, string, Action<PostgreSqlStorageOptions>?)
Registers PostgreSQL as the storage provider, from a connection string.
public static MillraceBuilder UsePostgreSqlStorage(this MillraceBuilder builder, string connectionString, Action<PostgreSqlStorageOptions>? configure = null)
Parameters
builderMillraceBuilderconnectionStringstringconfigureAction<PostgreSqlStorageOptions>
Returns
Remarks
Creates and owns an Npgsql.NpgsqlDataSource built from
connectionString. An application that already builds its own — to
configure logging, type mappings or pooling — should use the overload taking a factory
instead, so there is one data source rather than two.
Registration is last-wins, so calling this after another provider replaces it rather than conflicting.
Exceptions
- ArgumentException
connectionStringis empty.
UsePostgreSqlStorage(MillraceBuilder, Func<IServiceProvider, NpgsqlDataSource>, Action<PostgreSqlStorageOptions>?)
Overload for consumers who manage their own Npgsql.NpgsqlDataSource.
public static MillraceBuilder UsePostgreSqlStorage(this MillraceBuilder builder, Func<IServiceProvider, NpgsqlDataSource> dataSourceFactory, Action<PostgreSqlStorageOptions>? configure = null)
Parameters
builderMillraceBuilderdataSourceFactoryFunc<IServiceProvider, NpgsqlDataSource>configureAction<PostgreSqlStorageOptions>