Method ResultsBufferedAsync
- Namespace
- Open.Database.Extensions
- Assembly
- Open.Database.Extensions.Core.dll
ResultsBufferedAsync<T>(DbDataReader, IEnumerable<KeyValuePair<string, string?>>?, bool, CancellationToken)
Asynchronously returns all records and iteratively attempts to map the fields to type T.
public static ValueTask<IEnumerable<T>> ResultsBufferedAsync<T>(this DbDataReader reader, IEnumerable<KeyValuePair<string, string?>>? fieldMappingOverrides = null, bool useReadAsync = true, CancellationToken cancellationToken = default) where T : new()
Parameters
readerDbDataReaderThe IDataReader to read results from.
fieldMappingOverridesIEnumerable<KeyValuePair<string, string>>An override map of field names to column names where the keys are the property names, and values are the column names.
useReadAsyncboolIf 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.
cancellationTokenCancellationTokenOptional cancellation token.
Returns
- ValueTask<IEnumerable<T>>
A task containing the list of results.
Type Parameters
TThe model type to map the values to (using reflection).
ResultsBufferedAsync<T>(DbDataReader, IEnumerable<KeyValuePair<string, string?>>?, CancellationToken)
Asynchronously returns all records and iteratively attempts to map the fields to type T.
public static ValueTask<IEnumerable<T>> ResultsBufferedAsync<T>(this DbDataReader reader, IEnumerable<KeyValuePair<string, string?>>? fieldMappingOverrides, CancellationToken cancellationToken) where T : new()
Parameters
readerDbDataReaderThe IDataReader to read results from.
fieldMappingOverridesIEnumerable<KeyValuePair<string, string>>An override map of field names to column names where the keys are the property names, and values are the column names.
cancellationTokenCancellationTokenOptional cancellation token.
Returns
- ValueTask<IEnumerable<T>>
A task containing the list of results.
Type Parameters
TThe model type to map the values to (using reflection).
ResultsBufferedAsync<T>(DbDataReader, CancellationToken, params IEnumerable<KeyValuePair<string, string?>>?)
Asynchronously returns all records and iteratively attempts to map the fields to type T.
public static ValueTask<IEnumerable<T>> ResultsBufferedAsync<T>(this DbDataReader reader, CancellationToken cancellationToken, params IEnumerable<KeyValuePair<string, string?>>? fieldMappingOverrides) where T : new()
Parameters
readerDbDataReaderThe IDataReader to read results from.
cancellationTokenCancellationTokenOptional cancellation token.
fieldMappingOverridesIEnumerable<KeyValuePair<string, string>>An override map of field names to column names where the keys are the property names, and values are the column names.
Returns
- ValueTask<IEnumerable<T>>
A task containing the list of results.
Type Parameters
TThe model type to map the values to (using reflection).
ResultsBufferedAsync<T>(DbDataReader, IEnumerable<(string Field, string? Column)>?, bool, CancellationToken)
Asynchronously returns all records and iteratively attempts to map the fields to type T.
public static ValueTask<IEnumerable<T>> ResultsBufferedAsync<T>(this DbDataReader reader, IEnumerable<(string Field, string? Column)>? fieldMappingOverrides = null, bool useReadAsync = true, CancellationToken cancellationToken = default) where T : new()
Parameters
readerDbDataReaderThe IDataReader to read results from.
fieldMappingOverridesIEnumerable<(string Field, string Column)>An override map of field names to column names where the keys are the property names, and values are the column names.
useReadAsyncboolIf 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.
cancellationTokenCancellationTokenOptional cancellation token.
Returns
- ValueTask<IEnumerable<T>>
A task containing the list of results.
Type Parameters
TThe model type to map the values to (using reflection).
ResultsBufferedAsync<T>(DbDataReader, CancellationToken, params IEnumerable<(string Field, string? Column)>?)
Asynchronously returns all records and iteratively attempts to map the fields to type T.
public static ValueTask<IEnumerable<T>> ResultsBufferedAsync<T>(this DbDataReader reader, CancellationToken cancellationToken, params IEnumerable<(string Field, string? Column)>? fieldMappingOverrides) where T : new()
Parameters
readerDbDataReaderThe IDataReader to read results from.
cancellationTokenCancellationTokenOptional cancellation token.
fieldMappingOverridesIEnumerable<(string Field, string Column)>An override map of field names to column names where the keys are the property names, and values are the column names.
Returns
- ValueTask<IEnumerable<T>>
A task containing the list of results.
Type Parameters
TThe model type to map the values to (using reflection).