Method AddMapping
- Namespace
- YndigoBlue.Velocity.Model
- Assembly
- YndigoBlue.Velocity.dll
AddMapping(string, string, DataType)
Adds a mapping from a CSV header to a database column with the specified data type.
public void AddMapping(string header, string columnName, DataType columnType)
Parameters
headerstringThe CSV column header name.
columnNamestringThe target database column name.
columnTypeDataTypeThe DataType of the target column, used to convert the CSV string value.
Exceptions
- Exception
Thrown when
columnTypeis not a valid importable data type (e.g. String, Query, Guid, Unsupported).
AddMapping(int, string, DataType)
Adds a positional mapping for a headerless import, binding the zero-based source field at
columnNumber in each row to the target database column. Because the source
position is explicit, fields in the file may be skipped or read out of order. The ordinal is
ignored when UseColumnHeaders is true, since name-based
binding is used in that case.
public void AddMapping(int columnNumber, string columnName, DataType columnType)
Parameters
columnNumberintZero-based index of the source field within each file row.
columnNamestringThe target database column name.
columnTypeDataTypeThe DataType of the target column, used to convert the value.
Exceptions
- ArgumentOutOfRangeException
Thrown when
columnNumberis negative.- Exception
Thrown when
columnTypeis not a valid importable data type.