Table of Contents

Class DataRecordExtensions

Namespace
Open.Database.Extensions
Assembly
Open.Database.Extensions.Core.dll

Extension methods for reading column names, data type names, ordinals, and values from an IDataRecord, such as a data reader positioned on a row.

public static class DataRecordExtensions
Inheritance
DataRecordExtensions
Inherited Members

Remarks

These methods read the record's current row and result-set metadata; they never advance the reader. Methods that return a lazy IEnumerable<T> read from the record while they are enumerated, so enumerate them before the reader advances or is disposed. Methods that return an array, ImmutableArray<T>, or dictionary read everything before they return. Null database values are represented as DBNull, except where noted.

Methods

ColumnNames(IDataRecord)

Lazily enumerates the column names of the current result set in ordinal order.

DataTypeNames(IDataRecord)

Lazily enumerates the provider's data type name of every column of the current result set, in ordinal order.

EnumerateValues(IDataRecord)

Lazily enumerates the value of every column of the current row in ordinal order.

EnumerateValuesFromOrdinals(IDataRecord, IEnumerable<int>)

Lazily enumerates the values of the columns at the specified ordinals.

EnumerateValuesFromOrdinals(IDataRecord, IReadOnlyList<int>)

Lazily enumerates the values of the columns at the specified ordinals.

EnumerateValuesFromOrdinals(IDataRecord, int, params IEnumerable<int>)

Lazily enumerates the values of the columns at the specified ordinals.

GetDataTypeNames(IDataRecord)

Gets the provider's data type name of every column of the current result set, in ordinal order.

GetNames(IDataRecord)

Gets all the column names of the current result set in ordinal order.

GetNames(IDataRecord, IEnumerable<int>)

Gets the column names at the specified ordinals.

GetOrdinalMapping(IDataRecord, IEnumerable<string>, bool)

Looks up the ordinal of each requested column and returns the mappings as an array.

MatchingOrdinals(IDataRecord, IEnumerable<string>, bool)

Finds the requested columns that exist in the record, matching names case-insensitively.

OrdinalMapping(IDataRecord)

Lazily enumerates the name and ordinal of every column in the current result set.

OrdinalMapping(IDataRecord, IEnumerable<string>)

Lazily looks up the ordinal of each requested column.

OrdinalMapping(IDataRecord, IEnumerable<string>, bool)

Lazily looks up the ordinal of each requested column, optionally ordered by ordinal.

ToDictionary(IDataRecord, IEnumerable<ColumnOrdinal>)

Reads the specified columns of the current row into a dictionary keyed by column name.

ToDictionary(IDataRecord, IEnumerable<KeyValuePair<int, string>>)

Reads the specified columns of the current row into a dictionary keyed by the supplied names.

ToDictionary(IDataRecord, IEnumerable<string>)

Reads the named columns of the current row into a dictionary keyed by column name.

ToDictionary(IDataRecord, IReadOnlyList<ColumnOrdinal>)

Reads the specified columns of the current row into a dictionary keyed by column name.

ToDictionary(IDataRecord, IReadOnlyList<string>)

Reads the named columns of the current row into a dictionary keyed by column name.

ToDictionary(IDataRecord, ReadOnlySpan<ColumnOrdinal>)

Reads the specified columns of the current row into a dictionary keyed by column name.

ToDictionary(IDataRecord, ReadOnlySpan<string>)

Reads the named columns of the current row into a dictionary keyed by column name.