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
handlerAction<IDataReader>The handler function for the data reader.
behaviorCommandBehaviorThe 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
transformFunc<IDataReader, T>The transform function for each IDataRecord.
behaviorCommandBehaviorThe command behavior for once the command the reader is complete.
Returns
- T
The result of the transform.
Type Parameters
TThe 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
stateTStateThe state to pass to the transform.
transformFunc<IDataReader, TState, TResult>The transform function for the data reader.
behaviorCommandBehaviorThe command behavior for once the command the reader is complete.
Returns
- TResult
The result of the transform.
Type Parameters
TStateThe type of the state passed to the transform.
TResultThe return type of the transform function.