Interface ISqlServerSagaBuilder
Fluent builder interface for configuring SQL Server saga store settings.
public interface ISqlServerSagaBuilder
Remarks
Provides the canonical 4 connection overloads plus subsystem-specific configuration
for saga schema and table names. Follows the builder pattern established by
ISqlServerEventSourcingBuilder.
Connection overloads are mutually exclusive (last-wins): If multiple connection methods are called, the last one takes effect. Each call overwrites any previously configured connection.
The configured connection is shared by the saga store, timeout store, and monitoring service.
Usage:
services.AddExcalibur(x => x.AddSagas(saga =>
{
saga.UseSqlServer(sql =>
{
sql.ConnectionString("Server=...;Database=Sagas;...")
.SchemaName("dispatch")
.TableName("sagas");
})
.WithCoordination()
.WithTimeouts();
}));
Methods
BindConfiguration(string)
Binds options from an IConfiguration section.
ISqlServerSagaBuilder BindConfiguration(string sectionPath)
Parameters
sectionPathstringThe configuration section path (e.g., "Saga:SqlServer").
Returns
- ISqlServerSagaBuilder
The builder for fluent chaining.
Exceptions
- ArgumentException
Thrown when
sectionPathis null or whitespace.
ConnectionFactory(Func<IServiceProvider, Func<SqlConnection>>)
Sets a factory function that creates SQL connections. Use for Azure Managed Identity, Key Vault, or custom connection pooling.
ISqlServerSagaBuilder ConnectionFactory(Func<IServiceProvider, Func<SqlConnection>> connectionFactory)
Parameters
connectionFactoryFunc<IServiceProvider, Func<SqlConnection>>A factory receiving IServiceProvider and returning a
Func<SqlConnection>that creates connections on demand.
Returns
- ISqlServerSagaBuilder
The builder for fluent chaining.
Exceptions
- ArgumentNullException
Thrown when
connectionFactoryis null.
ConnectionString(string)
Sets the SQL Server connection string.
ISqlServerSagaBuilder ConnectionString(string connectionString)
Parameters
connectionStringstringThe SQL Server connection string.
Returns
- ISqlServerSagaBuilder
The builder for fluent chaining.
Exceptions
- ArgumentException
Thrown when
connectionStringis null or whitespace.
ConnectionStringName(string)
Resolves the connection string from IConfiguration.GetConnectionString(name)
at service resolution time.
ISqlServerSagaBuilder ConnectionStringName(string name)
Parameters
namestringThe connection string name in the
ConnectionStringssection.
Returns
- ISqlServerSagaBuilder
The builder for fluent chaining.
Exceptions
- ArgumentException
Thrown when
nameis null or whitespace.
SchemaName(string)
Sets the schema name for the saga table. Default: "dispatch".
ISqlServerSagaBuilder SchemaName(string schema)
Parameters
schemastringThe schema name.
Returns
- ISqlServerSagaBuilder
The builder for fluent chaining.
Exceptions
- ArgumentException
Thrown when
schemais null or whitespace.
TableName(string)
Sets the saga table name. Default: "sagas".
ISqlServerSagaBuilder TableName(string tableName)
Parameters
tableNamestringThe table name.
Returns
- ISqlServerSagaBuilder
The builder for fluent chaining.
Exceptions
- ArgumentException
Thrown when
tableNameis null or whitespace.