Table of Contents

Method Select

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

Select<T>(IDataReader, Func<IDataRecord, T>)

Iterates records from an IDataReader and passes the IDataRecord to a transform function.

public static IEnumerable<T> Select<T>(this IDataReader reader, Func<IDataRecord, T> transform)

Parameters

reader IDataReader

The reader to iterate.

transform Func<IDataRecord, T>

The transform function to process each IDataRecord.

Returns

IEnumerable<T>

An enumerable used to iterate the results.

Type Parameters

T

The return type of the transform function.

Select<T>(IDataReader, Func<IDataRecord, T>, CancellationToken, bool)

Iterates records from an IDataReader and passes the IDataRecord to a transform function.

public static IEnumerable<T> Select<T>(this IDataReader reader, Func<IDataRecord, T> transform, CancellationToken cancellationToken, bool throwOnCancellation = false)

Parameters

reader IDataReader

The reader to iterate.

transform Func<IDataRecord, T>

The transform function to process each IDataRecord.

cancellationToken CancellationToken

A cancellation token for stopping the iteration.

throwOnCancellation bool

If true, when canceled, may exit the iteration via an exception. Otherwise when canceled will simply stop iterating and return without exception.

Returns

IEnumerable<T>

An enumerable used to iterate the results.

Type Parameters

T

The return type of the transform function.

Select<T>(IDataReader, CancellationToken, Func<IDataRecord, T>, bool)

Iterates records from an IDataReader and passes the IDataRecord to a transform function.

public static IEnumerable<T> Select<T>(this IDataReader reader, CancellationToken cancellationToken, Func<IDataRecord, T> transform, bool throwOnCancellation = false)

Parameters

reader IDataReader

The reader to iterate.

cancellationToken CancellationToken

A cancellation token for stopping the iteration.

transform Func<IDataRecord, T>

The transform function to process each IDataRecord.

throwOnCancellation bool

If true, when canceled, may exit the iteration via an exception. Otherwise when canceled will simply stop iterating and return without exception.

Returns

IEnumerable<T>

An enumerable used to iterate the results.

Type Parameters

T

The return type of the transform function.