feat(etl): add MapOrdinal to IDataTransformer interface
Add MapOrdinal method to the IDataTransformer interface and provide a default implementation in DataTransformerBase. This enables transformers to report the mapping between transformed ordinals and source ordinals, supporting use cases like computed columns which return -1 to indicate no source ordinal. - Add MapOrdinal(int, IDataReader) to IDataTransformer interface - Add virtual MapOrdinal implementation in DataTransformerBase - Add DataTransformerBaseTests with test for default behavior
This commit is contained in:
@@ -62,4 +62,13 @@ public abstract class DataTransformerBase : IDataTransformer
|
||||
/// Override to handle null transformations.
|
||||
/// </summary>
|
||||
public virtual bool IsDBNull(int ordinal, IDataReader source) => source.IsDBNull(ordinal);
|
||||
|
||||
/// <summary>
|
||||
/// Maps a transformed ordinal to the source ordinal.
|
||||
/// Override to support column reordering or computed columns.
|
||||
/// </summary>
|
||||
/// <param name="transformedOrdinal">The ordinal in the transformed output.</param>
|
||||
/// <param name="source">The source data reader.</param>
|
||||
/// <returns>The corresponding source ordinal, or -1 for computed columns.</returns>
|
||||
public virtual int MapOrdinal(int transformedOrdinal, IDataReader source) => transformedOrdinal;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user