Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

DataReaderMappingExtensions

OfficeIMO.Data

Namespace
OfficeIMO.Data
Assembly
OfficeIMO.Core
Source revision
ba882f6b0d07 with working tree changes
Modifiers
static

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 required

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 required
configure System.Action<OfficeIMO.Data.RowMapper<T?>> required

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 required
Reader positioned before the first row to project.
factory System.Func<System.Data.IDataRecord, T?> required
Creates one model instance from the current row.

Returns

IEnumerable<T?>