Class DatabaseOptions
Represents the configuration settings required for CDC (Change Data Capture) processing.
public sealed class DatabaseOptions : IDatabaseOptions
- Inheritance
-
DatabaseOptions
- Implements
- Inherited Members
Remarks
The set of tracked tables is the single source of truth: CaptureInstances and
CaptureInstanceToTableNameMap are derived from Tables. Configure
each table with its logical TableName and, when the SQL Server
capture instance differs (e.g. the default {schema}_{table}), its
CaptureInstance.
These mutable options support configuration binding. A processor captures its own execution settings during construction; later option changes apply to newly constructed processors. Keep the input configuration stable while constructing a processor.
Constructors
DatabaseOptions()
Initializes database configuration with the standard processing defaults.
public DatabaseOptions()
DatabaseOptions(string, string, string)
Initializes database configuration with its three required identifiers.
public DatabaseOptions(string databaseName, string databaseConnectionIdentifier, string stateConnectionIdentifier)
Parameters
databaseNamestringThe name of the database being processed.
databaseConnectionIdentifierstringThe source database connection identifier.
stateConnectionIdentifierstringThe CDC state database connection identifier.
Remarks
The parameterless constructor and public setters support generated configuration binding. The containing job options retain their startup validation.
Properties
CaptureInstanceToTableNameMap
Gets a mapping from capture instance name to logical table name.
public IReadOnlyDictionary<string, string> CaptureInstanceToTableNameMap { get; }
Property Value
- IReadOnlyDictionary<string, string>
A read-only dictionary mapping capture instance names (e.g.,
dbo_Customers) to their logical table names (e.g.,dbo.Customers). When a capture instance has no explicit table name, the capture instance itself is the value.
Remarks
This map is used to translate capture instance names back to logical table names so that TableName contains the consumer-configured table name rather than the SQL Server CDC implementation detail.
CaptureInstances
Gets the list of CDC capture instances to process.
public string[] CaptureInstances { get; }
Property Value
- string[]
The list of CDC capture instances to process.
Remarks
Each capture instance corresponds to a table or set of tables tracked by CDC in the database.
ConsumerBatchSize
Gets the batch size used in the consumer loop.
public int ConsumerBatchSize { get; set; }
Property Value
- int
The batch size used in the consumer loop.
DatabaseConnectionIdentifier
Gets the unique identifier for the database connection.
[Required]
public string DatabaseConnectionIdentifier { get; set; }
Property Value
- string
The unique identifier for the database connection.
Remarks
This identifier is used to differentiate between multiple database connections.
DatabaseName
Gets the name of the database being processed.
[Required]
public string DatabaseName { get; set; }
Property Value
- string
The name of the database being processed.
ProducerBatchSize
Gets the batch size used in the producer loop.
public int ProducerBatchSize { get; set; }
Property Value
- int
The batch size used in the producer loop.
QueueSize
Gets the size of the in-memory data queue.
public int QueueSize { get; set; }
Property Value
- int
The size of the in-memory data queue.
RecoveryOptions
Gets the recovery options for handling stale CDC position scenarios.
public CdcRecoveryOptions? RecoveryOptions { get; set; }
Property Value
- CdcRecoveryOptions
The recovery options, or null to propagate stale-position failures.
Remarks
When null, stale checkpoints and source-history changes raise errors without resetting the saved position. Supply explicit options to enable a recovery strategy.
StateConnectionIdentifier
Gets the unique identifier for the connection to the state store database.
[Required]
public string StateConnectionIdentifier { get; set; }
Property Value
- string
The unique identifier for the connection to the state store database.
Remarks
The state store database is used to persist CDC processing state.
StopOnMissingTableHandler
Gets a value indicating whether processing should stop when a table handler is missing.
public bool StopOnMissingTableHandler { get; set; }
Property Value
Remarks
If true , the processing will stop and throw an exception when a table does not have a registered handler. If false
, processing will continue despite missing table handlers.
Tables
Gets or sets the tables tracked for CDC in this database.
public Collection<CdcTableConfig> Tables { get; set; }
Property Value
- Collection<CdcTableConfig>
The tracked tables. Each entry supplies a logical TableName and an optional CaptureInstance. CaptureInstances and CaptureInstanceToTableNameMap are derived from this collection.