Table of Contents

Interface ISqlServerSagaBuilder

Namespace
Excalibur.Saga.SqlServer
Assembly
Excalibur.Saga.SqlServer.dll

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

sectionPath string

The configuration section path (e.g., "Saga:SqlServer").

Returns

ISqlServerSagaBuilder

The builder for fluent chaining.

Exceptions

ArgumentException

Thrown when sectionPath is 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

connectionFactory Func<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 connectionFactory is null.

ConnectionString(string)

Sets the SQL Server connection string.

ISqlServerSagaBuilder ConnectionString(string connectionString)

Parameters

connectionString string

The SQL Server connection string.

Returns

ISqlServerSagaBuilder

The builder for fluent chaining.

Exceptions

ArgumentException

Thrown when connectionString is null or whitespace.

ConnectionStringName(string)

Resolves the connection string from IConfiguration.GetConnectionString(name) at service resolution time.

ISqlServerSagaBuilder ConnectionStringName(string name)

Parameters

name string

The connection string name in the ConnectionStrings section.

Returns

ISqlServerSagaBuilder

The builder for fluent chaining.

Exceptions

ArgumentException

Thrown when name is null or whitespace.

SchemaName(string)

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

ISqlServerSagaBuilder SchemaName(string schema)

Parameters

schema string

The schema name.

Returns

ISqlServerSagaBuilder

The builder for fluent chaining.

Exceptions

ArgumentException

Thrown when schema is null or whitespace.

TableName(string)

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

ISqlServerSagaBuilder TableName(string tableName)

Parameters

tableName string

The table name.

Returns

ISqlServerSagaBuilder

The builder for fluent chaining.

Exceptions

ArgumentException

Thrown when tableName is null or whitespace.