Table of Contents

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

builder MillraceBuilder
connectionString string
configure Action<PostgreSqlStorageOptions>

Returns

MillraceBuilder

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

connectionString is 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

builder MillraceBuilder
dataSourceFactory Func<IServiceProvider, NpgsqlDataSource>
configure Action<PostgreSqlStorageOptions>

Returns

MillraceBuilder