Class CdcRow
Represents a Change Data Capture (CDC) row retrieved from SQL Server.
public record CdcRow : IEquatable<CdcRow>
- Inheritance
-
CdcRow
- Implements
- Inherited Members
Remarks
A CDC row contains metadata about the operation (e.g., insert, update, delete), the associated LSN (Log Sequence Number), and the actual data changes.
Properties
Changes
Gets a dictionary containing the actual data changes for the CDC row.
public required IDictionary<string, object> Changes { get; init; }
Property Value
- IDictionary<string, object>
A dictionary containing the actual data changes for the CDC row.
Remarks
The dictionary contains column names as keys and their corresponding new values as values.
CommitTime
Gets the commit time of the transaction that caused the change.
public DateTime CommitTime { get; init; }
Property Value
- DateTime
The commit time of the transaction that caused the change.
DataTypes
Gets a dictionary mapping column names to their data types.
public required IReadOnlyDictionary<string, Type> DataTypes { get; init; }
Property Value
- IReadOnlyDictionary<string, Type>
A dictionary mapping column names to their data types.
Remarks
This is useful for interpreting the data changes with their corresponding data types. The dictionary is shared across all rows in a batch (the schema is identical for every row in the same result set). It is exposed as IReadOnlyDictionary<TKey, TValue> to enforce the no-mutation invariant.
Lsn
Gets the Log Sequence Number (LSN) associated with the CDC row.
public required byte[] Lsn { get; init; }
Property Value
- byte[]
The Log Sequence Number (LSN) associated with the CDC row.
Remarks
The LSN serves as a unique identifier for a transaction and its order in the CDC log.
OperationCode
Gets the operation code indicating the type of change.
public CdcOperationCodes OperationCode { get; init; }
Property Value
- CdcOperationCodes
The operation code indicating the type of change.
Remarks
Possible values are defined in the CdcOperationCodes enumeration.
SeqVal
Gets the sequence value for the change.
public required byte[] SeqVal { get; init; }
Property Value
- byte[]
The sequence value for the change.
Remarks
The sequence value helps identify multiple changes within the same transaction.
TableName
Gets or initializes the name of the table from which the CDC row originates.
public required string TableName { get; init; }
Property Value
- string
The name of the table from which the CDC row originates.