Table of Contents

Method Read

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

Read(Action<IEnumerable<T>>)

Executes the query and passes the mapped rows to handler as they are read.

void Read(Action<IEnumerable<T>> handler)

Parameters

handler Action<IEnumerable<T>>

Receives a forward-only sequence of mapped rows. Enumerate it inside the handler; it is not valid after the handler returns.

Remarks

The connection is opened if it is not already open and is released when the handler returns, whether the handler completes or throws. Exceptions from the provider propagate unchanged.

Read<TResult>(Func<IEnumerable<T>, TResult>)

Executes the query, passes the mapped rows to handler as they are read, and returns the handler's result.

TResult Read<TResult>(Func<IEnumerable<T>, TResult> handler)

Parameters

handler Func<IEnumerable<T>, TResult>

Receives a forward-only sequence of mapped rows. Enumerate it inside the handler; it is not valid after the handler returns.

Returns

TResult

The value returned by handler. Materialize it before returning (for example into a list) rather than returning the lazy sequence.

Type Parameters

TResult

The type returned by the handler.

Remarks

The connection is opened if it is not already open and is released when the handler returns, whether the handler completes or throws. Exceptions from the provider propagate unchanged.