Table of Contents

Class CdcDataChangeExtensions

Namespace
Excalibur.Cdc
Assembly
Excalibur.Cdc.dll

Extension methods for extracting typed values from CDC change data.

public static class CdcDataChangeExtensions
Inheritance
CdcDataChangeExtensions
Inherited Members

Remarks

These methods are designed for use in ICdcEventMapper<TEvent> implementations to extract column values from change data without reflection.

Methods

GetOldValue<T>(IReadOnlyList<CdcDataChange>, string)

Gets the old value (before change) of a column by name, cast to T.

public static T GetOldValue<T>(this IReadOnlyList<CdcDataChange> changes, string columnName)

Parameters

changes IReadOnlyList<CdcDataChange>

The list of column changes.

columnName string

The column name to look up.

Returns

T

The old value of the column cast to T.

Type Parameters

T

The expected type of the column value.

Exceptions

CdcMappingException

Thrown when the column is not found in the change data.

GetValue<T>(IReadOnlyList<CdcDataChange>, string)

Gets the new value of a column by name, cast to T.

public static T GetValue<T>(this IReadOnlyList<CdcDataChange> changes, string columnName)

Parameters

changes IReadOnlyList<CdcDataChange>

The list of column changes.

columnName string

The column name to look up.

Returns

T

The new value of the column cast to T.

Type Parameters

T

The expected type of the column value.

Exceptions

CdcMappingException

Thrown when the column is not found in the change data.

TryGetValue<T>(IReadOnlyList<CdcDataChange>, string, out T?)

Tries to get the new value of a column; returns false if the column is missing.

public static bool TryGetValue<T>(this IReadOnlyList<CdcDataChange> changes, string columnName, out T? value)

Parameters

changes IReadOnlyList<CdcDataChange>

The list of column changes.

columnName string

The column name to look up.

value T

When this method returns, contains the column value if found; otherwise, the default value.

Returns

bool

true if the column was found; otherwise, false.

Type Parameters

T

The expected type of the column value.