Interface ISqlServerOutboxBuilder
Fluent builder interface for configuring SQL Server-specific outbox settings.
public interface ISqlServerOutboxBuilder
- Extension Methods
Examples
outbox.UseSqlServer(sql =>
{
sql.ConnectionString("Server=.;Database=MyDb;Trusted_Connection=True;")
.SchemaName("Messaging")
.TableName("OutboxMessages");
});
Remarks
Provides the canonical 4 connection overloads plus subsystem-specific configuration
for outbox table names, schema, and operational settings. Follows the builder pattern
established by ISqlServerCdcConnectionBuilder.
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.
Methods
BindConfiguration(string)
Binds options from an IConfiguration section.
ISqlServerOutboxBuilder BindConfiguration(string sectionPath)
Parameters
sectionPathstringThe configuration section path (e.g., "Outbox:SqlServer").
Returns
- ISqlServerOutboxBuilder
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.
ISqlServerOutboxBuilder 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
- ISqlServerOutboxBuilder
The builder for fluent chaining.
Exceptions
- ArgumentNullException
Thrown when
connectionFactoryis null.
ConnectionString(string)
Sets the SQL Server connection string.
ISqlServerOutboxBuilder ConnectionString(string connectionString)
Parameters
connectionStringstringThe SQL Server connection string.
Returns
- ISqlServerOutboxBuilder
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.
ISqlServerOutboxBuilder ConnectionStringName(string name)
Parameters
namestringThe connection string name in the
ConnectionStringssection.
Returns
- ISqlServerOutboxBuilder
The builder for fluent chaining.
Exceptions
- ArgumentException
Thrown when
nameis null or whitespace.
EnableHealthChecks(string?)
Enables SQL Server health checks for the outbox store.
ISqlServerOutboxBuilder EnableHealthChecks(string? name = null)
Parameters
namestringOptional health check name. Default: "sqlserver-outbox".
Returns
- ISqlServerOutboxBuilder
The builder for fluent chaining.
Remarks
The check queries the outbox store itself, so it distinguishes a reachable database from a usable outbox: a database that answers while the outbox table cannot serve the drain reports unhealthy. Because it issues a query, treat it as a READINESS check rather than a liveness one.
SchemaName(string)
Sets the schema name for the outbox tables. Default: "dbo".
ISqlServerOutboxBuilder SchemaName(string schema)
Parameters
schemastringThe schema name (e.g., "dbo", "Messaging").
Returns
- ISqlServerOutboxBuilder
The builder for fluent chaining.
Exceptions
- ArgumentException
Thrown when
schemais null or whitespace.
TableName(string)
Sets the table name for storing outbox messages. Default: "OutboxMessages".
ISqlServerOutboxBuilder TableName(string tableName)
Parameters
tableNamestringThe table name.
Returns
- ISqlServerOutboxBuilder
The builder for fluent chaining.
Exceptions
- ArgumentException
Thrown when
tableNameis null or whitespace.
TransportsTableName(string)
Sets the table name for storing transport delivery records. Default: "OutboxMessageTransports".
ISqlServerOutboxBuilder TransportsTableName(string tableName)
Parameters
tableNamestringThe table name for transport records.
Returns
- ISqlServerOutboxBuilder
The builder for fluent chaining.
Exceptions
- ArgumentException
Thrown when
tableNameis null or whitespace.