Method ExecuteReaderAsync
- Namespace
- Open.Database.Extensions
- Assembly
- Open.Database.Extensions.Core.dll
ExecuteReaderAsync<TState, TResult>(TState, Func<IDataReader, TState, ValueTask<TResult>>, CancellationToken)
Executes a reader on the command,
passing state to transform.
public ValueTask<TResult> ExecuteReaderAsync<TState, TResult>(TState state, Func<IDataReader, TState, ValueTask<TResult>> transform, CancellationToken cancellationToken = default)
Parameters
stateTStateThe state to pass to the transform.
transformFunc<IDataReader, TState, ValueTask<TResult>>The transform function for the data reader.
cancellationTokenCancellationTokenA token that can cancel the call. It is used together with the command's own token (see UseCancellationToken(CancellationToken)); either one cancels.
Returns
- ValueTask<TResult>
A task that represents the asynchronous operation; its result is the result of
transform.
Type Parameters
TStateThe type of the state passed to the transform.
TResultThe return type of the transform function.
ExecuteReaderAsync<TState, TResult>(TState, Func<IDataReader, TState, ValueTask<TResult>>, CommandBehavior, CancellationToken)
Executes a reader on the command,
passing state to transform.
public ValueTask<TResult> ExecuteReaderAsync<TState, TResult>(TState state, Func<IDataReader, TState, ValueTask<TResult>> transform, CommandBehavior behavior, CancellationToken cancellationToken = default)
Parameters
stateTStateThe state to pass to the transform.
transformFunc<IDataReader, TState, ValueTask<TResult>>The transform function for the data reader.
behaviorCommandBehaviorThe behavior to run the reader with. The default is Default.
cancellationTokenCancellationTokenA token that can cancel the call. It is used together with the command's own token (see UseCancellationToken(CancellationToken)); either one cancels.
Returns
- ValueTask<TResult>
A task that represents the asynchronous operation; its result is the result of
transform.
Type Parameters
TStateThe type of the state passed to the transform.
TResultThe return type of the transform function.
ExecuteReaderAsync(Action<TReader>, CommandBehavior, CancellationToken)
Executes a reader on the command with a handler action.
public ValueTask ExecuteReaderAsync(Action<TReader> handler, CommandBehavior behavior = CommandBehavior.Default, CancellationToken cancellationToken = default)
Parameters
handlerAction<TReader>The handler function for the data reader.
behaviorCommandBehaviorThe behavior to run the reader with. The default is Default.
cancellationTokenCancellationTokenA token that can cancel the call. It is used together with the command's own token (see UseCancellationToken(CancellationToken)); either one cancels.
Returns
- ValueTask
A task that represents the asynchronous operation.
ExecuteReaderAsync(Action<TReader>, CancellationToken)
Executes a reader on the command with a handler action, and a token.
public ValueTask ExecuteReaderAsync(Action<TReader> handler, CancellationToken cancellationToken)
Parameters
handlerAction<TReader>The handler function for the data reader.
cancellationTokenCancellationTokenA token that can cancel the call. It is used together with the command's own token (see UseCancellationToken(CancellationToken)); either one cancels.
Returns
- ValueTask
A task that represents the asynchronous operation.
Remarks
This overload has no behavior parameter: to pass both a behavior
and a token, use the overload that takes the behavior and then the token.
ExecuteReaderAsync<T>(Func<TReader, T>, CommandBehavior, CancellationToken)
Executes a reader on the command with a transform function.
public ValueTask<T> ExecuteReaderAsync<T>(Func<TReader, T> handler, CommandBehavior behavior = CommandBehavior.Default, CancellationToken cancellationToken = default)
Parameters
handlerFunc<TReader, T>The handler function for the data reader.
behaviorCommandBehaviorThe behavior to run the reader with. The default is Default.
cancellationTokenCancellationTokenA token that can cancel the call. It is used together with the command's own token (see UseCancellationToken(CancellationToken)); either one cancels.
Returns
- ValueTask<T>
A task that represents the asynchronous operation; its result is the value returned by
handler.
Type Parameters
TThe type of the result.
ExecuteReaderAsync<T>(Func<TReader, T>, CancellationToken)
Executes a reader on the command with a transform function, and a token.
public ValueTask<T> ExecuteReaderAsync<T>(Func<TReader, T> handler, CancellationToken cancellationToken)
Parameters
handlerFunc<TReader, T>The handler function for the data reader.
cancellationTokenCancellationTokenA token that can cancel the call. It is used together with the command's own token (see UseCancellationToken(CancellationToken)); either one cancels.
Returns
- ValueTask<T>
A task that represents the asynchronous operation; its result is the value returned by
handler.
Type Parameters
TThe type of the result.
Remarks
This overload has no behavior parameter: to pass both a behavior
and a token, use the overload that takes the behavior and then the token.
ExecuteReaderAsync(Func<TReader, ValueTask>, CommandBehavior, CancellationToken)
Executes a reader on the command with an asynchronous handler function.
public ValueTask ExecuteReaderAsync(Func<TReader, ValueTask> handler, CommandBehavior behavior = CommandBehavior.Default, CancellationToken cancellationToken = default)
Parameters
handlerFunc<TReader, ValueTask>The handler function for the data reader.
behaviorCommandBehaviorThe behavior to run the reader with. The default is Default.
cancellationTokenCancellationTokenA token that can cancel the call. It is used together with the command's own token (see UseCancellationToken(CancellationToken)); either one cancels.
Returns
- ValueTask
A task that represents the asynchronous operation.
ExecuteReaderAsync(Func<TReader, ValueTask>, CancellationToken)
Executes a reader on the command with an asynchronous handler function, and a token.
public ValueTask ExecuteReaderAsync(Func<TReader, ValueTask> handler, CancellationToken cancellationToken)
Parameters
handlerFunc<TReader, ValueTask>The handler function for the data reader.
cancellationTokenCancellationTokenA token that can cancel the call. It is used together with the command's own token (see UseCancellationToken(CancellationToken)); either one cancels.
Returns
- ValueTask
A task that represents the asynchronous operation.
Remarks
This overload has no behavior parameter: to pass both a behavior
and a token, use the overload that takes the behavior and then the token.
ExecuteReaderAsync<T>(Func<TReader, ValueTask<T>>, CommandBehavior, CancellationToken)
Executes a reader on the command with an asynchronous transform function.
public ValueTask<T> ExecuteReaderAsync<T>(Func<TReader, ValueTask<T>> handler, CommandBehavior behavior = CommandBehavior.Default, CancellationToken cancellationToken = default)
Parameters
handlerFunc<TReader, ValueTask<T>>The handler function for the data reader.
behaviorCommandBehaviorThe behavior to run the reader with. The default is Default.
cancellationTokenCancellationTokenA token that can cancel the call. It is used together with the command's own token (see UseCancellationToken(CancellationToken)); either one cancels.
Returns
- ValueTask<T>
A task that represents the asynchronous operation; its result is the result of
handler.
Type Parameters
TThe type of the result.
ExecuteReaderAsync<T>(Func<TReader, ValueTask<T>>, CancellationToken)
Executes a reader on the command with an asynchronous transform function, and a token.
public ValueTask<T> ExecuteReaderAsync<T>(Func<TReader, ValueTask<T>> handler, CancellationToken cancellationToken)
Parameters
handlerFunc<TReader, ValueTask<T>>The handler function for the data reader.
cancellationTokenCancellationTokenA token that can cancel the call. It is used together with the command's own token (see UseCancellationToken(CancellationToken)); either one cancels.
Returns
- ValueTask<T>
A task that represents the asynchronous operation; its result is the result of
handler.
Type Parameters
TThe type of the result.
Remarks
This overload has no behavior parameter: to pass both a behavior
and a token, use the overload that takes the behavior and then the token.