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
readerDbDataReaderThe DbDataReader to read from.
transformFunc<IDataRecord, ValueTask<T>>The asynchronous function to transform each IDataRecord into a result.
cancellationTokenCancellationTokenThe 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
TThe return type of the transform function.
Exceptions
- ArgumentNullException
readerortransformis null.