Table of Contents

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

reader DbDataReader

The IDataReader to read results from.

fieldMappingOverrides IEnumerable<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.

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<IEnumerable<T>>

A task containing the list of results.

Type Parameters

T

The 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

reader DbDataReader

The IDataReader to read results from.

fieldMappingOverrides IEnumerable<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.

cancellationToken CancellationToken

Optional cancellation token.

Returns

ValueTask<IEnumerable<T>>

A task containing the list of results.

Type Parameters

T

The 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

reader DbDataReader

The IDataReader to read results from.

cancellationToken CancellationToken

Optional cancellation token.

fieldMappingOverrides IEnumerable<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

T

The 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

reader DbDataReader

The IDataReader to read results from.

fieldMappingOverrides IEnumerable<(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.

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<IEnumerable<T>>

A task containing the list of results.

Type Parameters

T

The 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

reader DbDataReader

The IDataReader to read results from.

cancellationToken CancellationToken

Optional cancellation token.

fieldMappingOverrides IEnumerable<(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

T

The model type to map the values to (using reflection).