Method ReadAsync
- Namespace
- Open.Database.Extensions
- Assembly
- Open.Database.Extensions.Core.dll
ReadAsync(Func<IAsyncEnumerable<T>, CancellationToken, ValueTask>, CancellationToken)
Passes the rows of the current result set to the asynchronous handler.
public ValueTask ReadAsync(Func<IAsyncEnumerable<T>, CancellationToken, ValueTask> handler, CancellationToken cancellationToken)
Parameters
handlerFunc<IAsyncEnumerable<T>, CancellationToken, ValueTask>Receives the rows, which are read as it enumerates them.
cancellationTokenCancellationTokenThe token that cancels the read.
Returns
Remarks
The rows are read from the reader as the handler enumerates them, and the reader is in use until the handler completes. For rows held in memory use ToListAsync(CancellationToken).
ReadAsync<TResult>(Func<IAsyncEnumerable<T>, CancellationToken, ValueTask<TResult>>, CancellationToken)
Passes the rows of the current result set to the asynchronous handler and returns its result.
public ValueTask<TResult> ReadAsync<TResult>(Func<IAsyncEnumerable<T>, CancellationToken, ValueTask<TResult>> handler, CancellationToken cancellationToken)
Parameters
handlerFunc<IAsyncEnumerable<T>, CancellationToken, ValueTask<TResult>>Receives the rows, which are read as it enumerates them.
cancellationTokenCancellationTokenThe token that cancels the read.
Returns
- ValueTask<TResult>
The value the handler returns.
Type Parameters
TResultThe type the handler returns.
Remarks
The rows are read from the reader as the handler enumerates them, and the reader is in use until the handler completes. For rows held in memory use ToListAsync(CancellationToken).