Table of Contents

Method ForEachAsync

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

ForEachAsync(DbDataReader, Action<IDataRecord>, bool, CancellationToken)

Iterates all records from an DbDataReader.

public static ValueTask ForEachAsync(this DbDataReader reader, Action<IDataRecord> handler, bool useReadAsync = true, CancellationToken cancellationToken = default)

Parameters

reader DbDataReader

The IDataReader to iterate.

handler Action<IDataRecord>

The handler function for each IDataRecord.

useReadAsync bool

If true (default) will iterate the results using .ReadAsync() otherwise will only Execute the reader asynchronously and then use .Read() to iterate the results but still allowing cancellation.

cancellationToken CancellationToken

Optional cancellation token.

Returns

ValueTask

ForEachAsync(DbDataReader, Func<IDataRecord, ValueTask>, bool, CancellationToken)

Iterates all records from an DbDataReader.

public static ValueTask ForEachAsync(this DbDataReader reader, Func<IDataRecord, ValueTask> handler, bool useReadAsync = true, CancellationToken cancellationToken = default)

Parameters

reader DbDataReader

The IDataReader to iterate.

handler Func<IDataRecord, ValueTask>

The handler function for each IDataRecord.

useReadAsync bool

If true (default) will iterate the results using .ReadAsync() otherwise will only Execute the reader asynchronously and then use .Read() to iterate the results but still allowing cancellation.

cancellationToken CancellationToken

Optional cancellation token.

Returns

ValueTask

ForEachAsync(DbDataReader, Func<IDataRecord, ValueTask>, CancellationToken)

Iterates all records from an DbDataReader.

public static ValueTask ForEachAsync(this DbDataReader reader, Func<IDataRecord, ValueTask> handler, CancellationToken cancellationToken)

Parameters

reader DbDataReader

The IDataReader to iterate.

handler Func<IDataRecord, ValueTask>

The handler function for each IDataRecord.

cancellationToken CancellationToken

Optional cancellation token.

Returns

ValueTask