Interface IPostgresSagaBuilder
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
sectionPathstringThe configuration section path.
Returns
- IPostgresSagaBuilder
The builder for fluent chaining.
ConnectionString(string)
Sets the Postgres connection string.
IPostgresSagaBuilder ConnectionString(string connectionString)
Parameters
connectionStringstringThe 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
namestringThe connection string name.
Returns
- IPostgresSagaBuilder
The builder for fluent chaining.
DataSource(NpgsqlDataSource)
Sets a pre-configured Npgsql.NpgsqlDataSource directly.
IPostgresSagaBuilder DataSource(NpgsqlDataSource dataSource)
Parameters
dataSourceNpgsqlDataSourceThe 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
dataSourceFactoryFunc<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
schemastringThe schema name.
Returns
- IPostgresSagaBuilder
The builder for fluent chaining.
TableName(string)
Sets the saga table name. Default: "sagas".
IPostgresSagaBuilder TableName(string tableName)
Parameters
tableNamestringThe table name.
Returns
- IPostgresSagaBuilder
The builder for fluent chaining.