Table of Contents

Interface IPostgresSagaBuilder

Namespace
Excalibur.Saga.Postgres
Assembly
Excalibur.Saga.Postgres.dll

Fluent builder interface for configuring Postgres saga store settings.

public interface IPostgresSagaBuilder

Remarks

Provides 5 canonical connection overloads plus subsystem-specific configuration for schema and table names. Connection overloads are mutually exclusive (last-wins).

All connection paths converge to Npgsql.NpgsqlDataSource: ConnectionString(string) and ConnectionStringName(string) create an Npgsql.NpgsqlDataSource internally for proper connection pooling.

Usage:

services.AddExcalibur(x => x.AddSagas(saga =>
{
    saga.UsePostgres(pg =>
    {
        pg.ConnectionString("Host=localhost;Database=MyApp;")
          .SchemaName("dispatch")
          .TableName("sagas");
    });
}));

Methods

BindConfiguration(string)

Binds options from an IConfiguration section.

IPostgresSagaBuilder BindConfiguration(string sectionPath)

Parameters

sectionPath string

The configuration section path.

Returns

IPostgresSagaBuilder

The builder for fluent chaining.

ConnectionString(string)

Sets the Postgres connection string.

IPostgresSagaBuilder ConnectionString(string connectionString)

Parameters

connectionString string

The Postgres connection string.

Returns

IPostgresSagaBuilder

The builder for fluent chaining.

ConnectionStringName(string)

Resolves the connection string from IConfiguration.GetConnectionString(name).

IPostgresSagaBuilder ConnectionStringName(string name)

Parameters

name string

The connection string name.

Returns

IPostgresSagaBuilder

The builder for fluent chaining.

DataSource(NpgsqlDataSource)

Sets a pre-configured Npgsql.NpgsqlDataSource directly.

IPostgresSagaBuilder DataSource(NpgsqlDataSource dataSource)

Parameters

dataSource NpgsqlDataSource

The Npgsql data source.

Returns

IPostgresSagaBuilder

The builder for fluent chaining.

DataSourceFactory(Func<IServiceProvider, NpgsqlDataSource>)

Sets a factory function that creates an Npgsql.NpgsqlDataSource.

IPostgresSagaBuilder DataSourceFactory(Func<IServiceProvider, NpgsqlDataSource> dataSourceFactory)

Parameters

dataSourceFactory Func<IServiceProvider, NpgsqlDataSource>

A factory receiving IServiceProvider and returning an Npgsql.NpgsqlDataSource.

Returns

IPostgresSagaBuilder

The builder for fluent chaining.

SchemaName(string)

Sets the schema name for the saga table. Default: "dispatch".

IPostgresSagaBuilder SchemaName(string schema)

Parameters

schema string

The schema name.

Returns

IPostgresSagaBuilder

The builder for fluent chaining.

TableName(string)

Sets the saga table name. Default: "sagas".

IPostgresSagaBuilder TableName(string tableName)

Parameters

tableName string

The table name.

Returns

IPostgresSagaBuilder

The builder for fluent chaining.