Method ToListAsync
- Namespace
- Open.Database.Extensions
- Assembly
- Open.Database.Extensions.Core.dll
ToListAsync<T>(DbDataReader, Func<IDataRecord, T>, CancellationToken)
Asynchronously iterates all records using the data reader and returns the desired results as a list.
public static ValueTask<List<T>> ToListAsync<T>(this DbDataReader reader, Func<IDataRecord, T> transform, CancellationToken cancellationToken = default)
Parameters
readerDbDataReaderThe SqlDataReader to read from.
transformFunc<IDataRecord, T>The transform function to process each IDataRecord.
cancellationTokenCancellationTokenOptional cancellation token.
Returns
Type Parameters
TThe return type of the transform function.
ToListAsync<T>(DbDataReader, Func<IDataRecord, ValueTask<T>>, CancellationToken)
Asynchronously iterates all records using the data reader and returns the desired results as a list.
public static ValueTask<List<T>> ToListAsync<T>(this DbDataReader reader, Func<IDataRecord, ValueTask<T>> transform, CancellationToken cancellationToken = default)
Parameters
readerDbDataReaderThe SqlDataReader to read from.
transformFunc<IDataRecord, ValueTask<T>>The transform function to process each IDataRecord.
cancellationTokenCancellationTokenOptional cancellation token.
Returns
Type Parameters
TThe return type of the transform function.