Interface ICdcBuilderDiscovery
Provides table discovery and configuration-binding capabilities for the CDC builder.
public interface ICdcBuilderDiscovery
Remarks
Separated from ICdcBuilder following the Interface Segregation Principle. Consumers that only need explicit table tracking via TrackTable(string, Action<ICdcTableBuilder>) do not need to depend on discovery features.
Implementations that support discovery should implement both ICdcBuilder and ICdcBuilderDiscovery.
Methods
BindTrackedTables(string)
Binds tracked tables from an IConfiguration section.
ICdcBuilder BindTrackedTables(string configSectionPath)
Parameters
configSectionPathstringThe configuration section path containing an array of table tracking entries (e.g.,
"Cdc:Tables").
Returns
- ICdcBuilder
The builder for fluent chaining.
Examples
services.AddCdcProcessor(cdc =>
{
cdc.UseSqlServer(sql => sql.ConnectionString(connectionString))
.BindTrackedTables("Cdc:Tables")
.EnableBackgroundProcessing();
});
Remarks
Tables bound from configuration are merged additively with tables registered via TrackTable(string, Action<ICdcTableBuilder>). Duplicate table names (case-insensitive) are skipped -- code-registered tables take precedence.
Event mappings cannot be expressed in configuration and remain code-only via TrackTable(string, Action<ICdcTableBuilder>).
Exceptions
- ArgumentException
Thrown when
configSectionPathis null or whitespace.
TrackTablesFromHandlers()
Enables automatic discovery of tracked tables from registered ICdcTableProvider implementations in DI.
ICdcBuilder TrackTablesFromHandlers()
Returns
- ICdcBuilder
The builder for fluent chaining.
Examples
services.AddCdcProcessor(cdc =>
{
cdc.UseSqlServer(sql => sql.ConnectionString(connectionString))
.TrackTablesFromHandlers()
.EnableBackgroundProcessing();
});
Remarks
At startup, all ICdcTableProvider services are resolved from DI, and each provider's TableNames are registered as tracked tables. Tables already registered by code (via TrackTable(string, Action<ICdcTableBuilder>)) or configuration (via BindTrackedTables(string)) take precedence -- duplicates by table name (case-insensitive) are skipped.
This bridges provider-specific handler interfaces (e.g., SQL Server's
IDataChangeHandler) with the cross-provider CDC tracking system.
Provider-specific handlers that implement ICdcTableProvider
are automatically discovered.