Search Results for

    Show / Hide Table of Contents

    Interface IRowMapperCommand

    This interface contains commands for mapping columns from a source row to a target row. The source and target can be different from each other, and might be tables, queries etc. in external data sources, or fields and properties in .NET CLR types. It is often used as a worker parameter or property, to allow the user to specify which columns to map or copy. The worker then uses e.g. TypeColumnCopier<TFrom, TTo> to generate a high performance copying delegate, or uses TypeRowMapper<TFrom, TTo>, FromTypeRowMapper<TFrom>, or ToTypeRowMapper<TTo> to create mappings and perform the copying etc. itself.

    This interface does include the Row() method, also see IColumnMapperCommand which excludes that method.

    See Dataflow Column Mapping and Mapping and Copying for more details.

    Note: If the mapping commands result in duplicate mappings, an exception will be thrown. Resolve this by either of:

    • Specify additional or all name parts in explicit mapping
    • Change the column (or schema) names in the from and/or to rows to avoid name clashes
    • Restrict auto-mapping to specific column schemas
    • Map offending columns explicitly by name (which will exclude them from later auto-mappings)

    Inherited Members
    IFluentInterface.GetType()
    IFluentInterface.GetHashCode()
    IFluentInterface.ToString()
    IFluentInterface.Equals(Object)
    Namespace: actionETL
    Assembly: actionETL.dll
    Syntax
    public interface IRowMapperCommand : IFluentInterface

    Methods

    AutoName()

    Map automatically by name. Identical names will match, as will partial names where one or more of the left-most parts of the name have been left out. E.g., "Person.Name.FirstName" would automatically map to either of "FirstName" and "Name.FirstName". More matching parts take precedence over fewer matching parts.

    Column name matching is ordinal case insensitive, but a case sensitive match takes precedence over a case insensitive match.

    The mapping only considers readable (see CanRead) 'from' columns and writable (see CanWrite) 'to' columns.

    Note: If there are still more than one possible mapping, an exception will be thrown. Resolve this by either of:

    • Change the column names in the row(s) to avoid name clashes
    • Use one of the overloads that allows restricting the auto-mapping to specific hierarchy names
    • Map offending columns individually by name (which will exclude them from later mappings), before calling this auto-mapping method

    Declaration
    IRowMapperCommand AutoName()
    Returns
    Type Description
    IRowMapperCommand

    The IRowMapperCommand instance itself, which allows chaining commands.

    Exceptions
    Type Condition
    InvalidOperationException
    • Duplicate matches.
    • Mapping the row as a single unit is mutually exclusive with commands mapping individual columns.

    AutoName(Int32)

    Map automatically by name. Identical names will match, as will partial names where one or more of the left-most parts of the name have been left out. E.g., "Person.Name.FirstName" would automatically map to either of "FirstName" and "Name.FirstName". More matching parts take precedence over fewer matching parts.

    Column name matching is ordinal case insensitive, but a case sensitive match takes precedence over a case insensitive match.

    The mapping only considers readable (see CanRead) 'from' columns and writable (see CanWrite) 'to' columns.

    Note: If there are still more than one possible mapping, an exception will be thrown. Resolve this by either of:

    • Change the column names in the row(s) to avoid name clashes
    • Use one of the overloads that allows restricting the auto-mapping to specific hierarchy names
    • Map offending columns individually by name (which will exclude them from later mappings), before calling this auto-mapping method

    Declaration
    IRowMapperCommand AutoName(int assertNumberOfMatches)
    Parameters
    Type Name Description
    Int32 assertNumberOfMatches

    Assert number of matches.

    Returns
    Type Description
    IRowMapperCommand

    The IRowMapperCommand instance itself, which allows chaining commands.

    Exceptions
    Type Condition
    InvalidOperationException
    • Duplicate matches.
    • Mapping the row as a single unit is mutually exclusive with commands mapping individual columns.

    AutoName(Int32, String, String)

    Map automatically by name. Identical names will match, as will partial names where one or more of the left-most parts of the name have been left out. E.g., "Person.Name.FirstName" would automatically map to either of "FirstName" and "Name.FirstName". More matching parts take precedence over fewer matching parts.

    Column name matching is ordinal case insensitive, but a case sensitive match takes precedence over a case insensitive match.

    The mapping only considers readable (see CanRead) 'from' columns and writable (see CanWrite) 'to' columns.

    Note: If there are still more than one possible mapping, an exception will be thrown. Resolve this by either of:

    • Change the column names in the row(s) to avoid name clashes
    • Restrict the auto-mapping to specific hierarchy names
    • Map offending columns individually by name (which will exclude them from later mappings), before calling this auto-mapping method

    Declaration
    IRowMapperCommand AutoName(int assertNumberOfMatches, string fromHierarchyName, string toHierarchyName)
    Parameters
    Type Name Description
    Int32 assertNumberOfMatches

    Assert number of matches.

    String fromHierarchyName

    Hierarchy from name to include, or null to include all members. Name parts can be omitted from the right, e.g. specifying "Person" will only auto-map from the "Person" member residing directly in the root of the row class, and any descendants of "Person".

    String toHierarchyName

    Hierarchy to name to include, or null to include all members. Name parts can be omitted from the right, e.g. specifying "Person" will only auto-map to the "Person" member residing directly in the root of the row class, and any descendants of "Person".

    Returns
    Type Description
    IRowMapperCommand

    The IRowMapperCommand instance itself, which allows chaining commands.

    Exceptions
    Type Condition
    InvalidOperationException
    • Duplicate matches.
    • Mapping the row as a single unit is mutually exclusive with commands mapping individual columns.

    AutoName(String, String)

    Map automatically by name. Identical names will match, as will partial names where one or more of the left-most parts of the name have been left out. E.g., "Person.Name.FirstName" would automatically map to either of "FirstName" and "Name.FirstName". More matching parts take precedence over fewer matching parts.

    Column name matching is ordinal case insensitive, but a case sensitive match takes precedence over a case insensitive match.

    The mapping only considers readable (see CanRead) 'from' columns and writable (see CanWrite) 'to' columns.

    Note: If there are still more than one possible mapping, an exception will be thrown. Resolve this by either of:

    • Change the column names in the row(s) to avoid name clashes
    • Restrict the auto-mapping to specific hierarchy names
    • Map offending columns individually by name (which will exclude them from later mappings), before calling this auto-mapping method

    Declaration
    IRowMapperCommand AutoName(string fromHierarchyName, string toHierarchyName)
    Parameters
    Type Name Description
    String fromHierarchyName

    Hierarchy from name to include, or null to include all members. Name parts can be omitted from the right, e.g. specifying "Person" will only auto-map from the "Person" member residing directly in the root of the row class, and any descendants of "Person".

    String toHierarchyName

    Hierarchy to name to include, or null to include all members. Name parts can be omitted from the right, e.g. specifying "Person" will only auto-map to the "Person" member residing directly in the root of the row class, and any descendants of "Person".

    Returns
    Type Description
    IRowMapperCommand

    The IRowMapperCommand instance itself, which allows chaining commands.

    Exceptions
    Type Condition
    InvalidOperationException
    • Duplicate matches.
    • Mapping the row as a single unit is mutually exclusive with commands mapping individual columns.

    Index(Int32, Int32)

    Map a 'from' column to a 'to' column based on their index in SchemaNodeList.

    Declaration
    IRowMapperCommand Index(int fromSchemaNodeListIndex, int toSchemaNodeListIndex)
    Parameters
    Type Name Description
    Int32 fromSchemaNodeListIndex

    From index.

    Int32 toSchemaNodeListIndex

    To index.

    Returns
    Type Description
    IRowMapperCommand

    The IRowMapperCommand instance itself, which allows chaining commands.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    schemaNodeListIndex was outside [0, number of items).

    InvalidOperationException
    • Column already mapped
    • Duplicate column mappings
    • Mapping the row as a single unit is mutually exclusive with commands mapping individual columns.

    Name(String)

    Map a 'from' column to a 'to' column based on their names.

    Column name matching is ordinal case insensitive, but a case sensitive match takes precedence over a case insensitive match.

    Declaration
    IRowMapperCommand Name(string schemaNodeName)
    Parameters
    Type Name Description
    String schemaNodeName

    Name of both the 'from' and 'to' columns. Column schema names can optionally be omitted from the left, as long as the specified name is unique among all columns in the row. E.g., assuming "FirstName" is unique, the following can all identify the same column:

    • "Person.Name.FirstName"
    • "Name.FirstName"
    • "FirstName"

    Returns
    Type Description
    IRowMapperCommand

    The IRowMapperCommand instance itself, which allows chaining commands.

    Exceptions
    Type Condition
    InvalidOperationException
    • Member not found
    • Found more than one member match in type
    • Name already mapped
    • Mapping the row as a single unit is mutually exclusive with commands mapping individual columns.
    ArgumentNullException

    schemaNodeName

    Name(String, String)

    Map a 'from' column to a 'to' column based on their names.

    Column name matching is ordinal case insensitive, but a case sensitive match takes precedence over a case insensitive match.

    Declaration
    IRowMapperCommand Name(string fromSchemaNodeName, string toSchemaNodeName)
    Parameters
    Type Name Description
    String fromSchemaNodeName

    Name of the 'from' column. Column schema names can optionally be omitted from the left, as long as the specified name is unique among all columns in the row. E.g., assuming "FirstName" is unique, the following can all identify the same column:

    • "Person.Name.FirstName"
    • "Name.FirstName"
    • "FirstName"

    String toSchemaNodeName

    Name of the 'to' column. Column schema names can optionally be omitted from the left, as long as the specified name is unique among all columns in the row. E.g., assuming "FirstName" is unique, the following can all identify the same column:

    • "Person.Name.FirstName"
    • "Name.FirstName"
    • "FirstName"

    Returns
    Type Description
    IRowMapperCommand

    The IRowMapperCommand instance itself, which allows chaining commands.

    Exceptions
    Type Condition
    InvalidOperationException
    • Member not found
    • Found more than one member match in type
    • Name already mapped
    • Mapping the row as a single unit is mutually exclusive with commands mapping individual columns.
    ArgumentNullException
    • fromSchemaNodeName
    • toSchemaNodeName

    Row()

    Map the whole row. Mutually exclusive with commands mapping individual columns. It is up to the caller to decide how to react to a whole row mapping.

    Declaration
    IRowMapperCommand Row()
    Returns
    Type Description
    IRowMapperCommand
    Exceptions
    Type Condition
    InvalidOperationException

    Mapping the row as a single unit is mutually exclusive with commands mapping individual columns

    See Also

    TypeRowMapper<TFrom, TTo>
    TypeRowMappings
    FromTypeRowMapper<TFrom>
    FromTypeRowMappings
    ToTypeRowMapper<TTo>
    ToTypeRowMappings
    IColumnMapperCommand
    TypeColumnCopier<TFrom, TTo>
    In This Article
    • Methods
      • AutoName()
      • AutoName(Int32)
      • AutoName(Int32, String, String)
      • AutoName(String, String)
      • Index(Int32, Int32)
      • Name(String)
      • Name(String, String)
      • Row()
    • See Also
    Back to top Copyright © 2023 Envobi Ltd