Table of Contents

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

handler Func<IAsyncEnumerable<T>, CancellationToken, ValueTask>

Receives the rows, which are read as it enumerates them.

cancellationToken CancellationToken

The token that cancels the read.

Returns

ValueTask

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

handler Func<IAsyncEnumerable<T>, CancellationToken, ValueTask<TResult>>

Receives the rows, which are read as it enumerates them.

cancellationToken CancellationToken

The token that cancels the read.

Returns

ValueTask<TResult>

The value the handler returns.

Type Parameters

TResult

The 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).