Table of Contents

Method ExecuteReader

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

ExecuteReader(Action<IDataReader>, CommandBehavior)

Executes a reader on a command with a handler function.

void ExecuteReader(Action<IDataReader> handler, CommandBehavior behavior = CommandBehavior.Default)

Parameters

handler Action<IDataReader>

The handler function for the data reader.

behavior CommandBehavior

The command behavior for once the command the reader is complete.

ExecuteReader<T>(Func<IDataReader, T>, CommandBehavior)

Executes a reader on a command with a transform function.

T ExecuteReader<T>(Func<IDataReader, T> transform, CommandBehavior behavior = CommandBehavior.Default)

Parameters

transform Func<IDataReader, T>

The transform function for each IDataRecord.

behavior CommandBehavior

The command behavior for once the command the reader is complete.

Returns

T

The result of the transform.

Type Parameters

T

The return type of the transform function.

ExecuteReader<TState, TResult>(TState, Func<IDataReader, TState, TResult>, CommandBehavior)

Executes a reader on a command, passing state to transform. Pass a static lambda and the state it needs to avoid allocating a closure per call.

TResult ExecuteReader<TState, TResult>(TState state, Func<IDataReader, TState, TResult> transform, CommandBehavior behavior = CommandBehavior.Default)

Parameters

state TState

The state to pass to the transform.

transform Func<IDataReader, TState, TResult>

The transform function for the data reader.

behavior CommandBehavior

The command behavior for once the command the reader is complete.

Returns

TResult

The result of the transform.

Type Parameters

TState

The type of the state passed to the transform.

TResult

The return type of the transform function.