Method OrdinalMapping
- Namespace
- Open.Database.Extensions
- Assembly
- Open.Database.Extensions.Core.dll
OrdinalMapping(IDataRecord)
Lazily enumerates the name and ordinal of every column in the current result set.
public static IEnumerable<ColumnOrdinal> OrdinalMapping(this IDataRecord record)
Parameters
recordIDataRecordThe record to get the column names from.
Returns
- IEnumerable<ColumnOrdinal>
An enumerable of the mappings in ordinal order.
Exceptions
- ArgumentNullException
recordis null.
OrdinalMapping(IDataRecord, IEnumerable<string>)
Lazily looks up the ordinal of each requested column.
public static IEnumerable<ColumnOrdinal> OrdinalMapping(this IDataRecord record, IEnumerable<string> columnNames)
Parameters
recordIDataRecordThe record to query the ordinals from.
columnNamesIEnumerable<string>The requested column names, looked up with GetOrdinal(string), which falls back to a case-insensitive match.
Returns
- IEnumerable<ColumnOrdinal>
An enumerable of mappings, in the order requested. Each name is the column's actual name in the record, which can differ in casing from the requested name.
Exceptions
- ArgumentNullException
recordorcolumnNamesis null. It is thrown by the call, not while the result is enumerated.- IndexOutOfRangeException
A requested column does not exist. It is thrown while the result is enumerated.
- See Also
OrdinalMapping(IDataRecord, IEnumerable<string>, bool)
Lazily looks up the ordinal of each requested column, optionally ordered by ordinal.
public static IEnumerable<ColumnOrdinal> OrdinalMapping(this IDataRecord record, IEnumerable<string> columnNames, bool sort)
Parameters
recordIDataRecordThe record to query the ordinals from.
columnNamesIEnumerable<string>The requested column names.
sortbooltrue to order the results by ordinal ascending; false to keep the requested order.
Returns
- IEnumerable<ColumnOrdinal>
An enumerable of mappings.
Exceptions
- ArgumentNullException
recordorcolumnNamesis null. It is thrown by the call, not while the result is enumerated.- IndexOutOfRangeException
A requested column does not exist. It is thrown while the result is enumerated.
- See Also