Class
DataReaderMappingExtensions
OfficeIMO.Data
Typed row projections for any forward-only DbDataReader.
Inheritance
- object
- DataReaderMappingExtensions
Methods
RowsAs``1 3 overloads
public static IEnumerable<T?> RowsAs<T>(DbDataReader reader) #Projects the remaining unread rows by matching column names to public properties and their constructor parameters. The caller retains ownership of the reader.
Type Parameters
- T
Parameters
- reader System.Data.Common.DbDataReader
Returns
IEnumerable<T?>public static IEnumerable<T?> RowsAs<T>(DbDataReader reader, Action<RowMapper<T?>> configure) #Projects the remaining unread rows using explicit column assignments. The caller retains ownership of the reader.
Type Parameters
- T
Parameters
- reader System.Data.Common.DbDataReader
- configure System.Action<OfficeIMO.Data.RowMapper<T?>>
Returns
IEnumerable<T?>public static IEnumerable<T?> RowsAs<T>(DbDataReader reader, Func<IDataRecord, T?> factory) #Projects the remaining unread rows with a caller-supplied factory. This overload supports constructor-bound and other models without a public parameterless constructor. The caller retains ownership of the reader.
Type Parameters
- T
Parameters
- reader System.Data.Common.DbDataReader
- Reader positioned before the first row to project.
- factory System.Func<System.Data.IDataRecord, T?>
- Creates one model instance from the current row.
Returns
IEnumerable<T?>