Table of Contents

Method ToListAsync

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

ToListAsync<T>(DbDataReader, Func<IDataRecord, ValueTask<T>>, CancellationToken)

Asynchronously iterates the remaining records of the current result set and returns the results of an asynchronous transform as a list.

public static ValueTask<List<T>> ToListAsync<T>(this DbDataReader reader, Func<IDataRecord, ValueTask<T>> transform, CancellationToken cancellationToken = default)

Parameters

reader DbDataReader

The DbDataReader to read from.

transform Func<IDataRecord, ValueTask<T>>

The asynchronous function to transform each IDataRecord into a result.

cancellationToken CancellationToken

The token to monitor for cancellation requests. The default is None.

Returns

ValueTask<List<T>>

A task that represents the asynchronous operation. Its result is a list of the transformed results.

Type Parameters

T

The return type of the transform function.

Exceptions

ArgumentNullException

reader or transform is null.