Table of Contents

Method ResultsAsync

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

ResultsAsync<T>(DbDataReader, IEnumerable<KeyValuePair<string, string?>>?, CancellationToken)

Asynchronously iterates each record and attempts to map the fields to type T.

public static IAsyncEnumerable<T> ResultsAsync<T>(this DbDataReader reader, IEnumerable<KeyValuePair<string, string?>>? fieldMappingOverrides = null, CancellationToken cancellationToken = default) where T : new()

Parameters

reader DbDataReader

The IDataReader to read results from.

fieldMappingOverrides IEnumerable<KeyValuePair<string, string>>

An optional override map of field names to column names where the keys are the property names, and values are the column names.

cancellationToken CancellationToken

An optional cancellation token.

Returns

IAsyncEnumerable<T>

The enumerable to pull the transformed results from.

Type Parameters

T

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

ResultsAsync<T>(DbDataReader, IEnumerable<(string Field, string? Column)>?, CancellationToken)

Asynchronously iterates each record and attempts to map the fields to type T.

public static IAsyncEnumerable<T> ResultsAsync<T>(this DbDataReader reader, IEnumerable<(string Field, string? Column)>? fieldMappingOverrides = null, CancellationToken cancellationToken = default) where T : new()

Parameters

reader DbDataReader

The IDataReader to read results from.

fieldMappingOverrides IEnumerable<(string Field, string Column)>

An optional override map of field names to column names where the keys are the property names, and values are the column names.

cancellationToken CancellationToken

An optional cancellation token.

Returns

IAsyncEnumerable<T>

The enumerable to pull the transformed results from.

Type Parameters

T

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

ResultsAsync<T>(DbDataReader, CancellationToken, params IEnumerable<KeyValuePair<string, string?>>?)

Asynchronously iterates each record and attempts to map the fields to type T.

public static IAsyncEnumerable<T> ResultsAsync<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

An optional cancellation token.

fieldMappingOverrides IEnumerable<KeyValuePair<string, string>>

An optional override map of field names to column names where the keys are the property names, and values are the column names.

Returns

IAsyncEnumerable<T>

The enumerable to pull the transformed results from.

Type Parameters

T

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

ResultsAsync<T>(DbDataReader, CancellationToken, params IEnumerable<(string Field, string? Column)>?)

Asynchronously iterates each record and attempts to map the fields to type T.

public static IAsyncEnumerable<T> ResultsAsync<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

An optional cancellation token.

fieldMappingOverrides IEnumerable<(string Field, string Column)>

An optional override map of field names to column names where the keys are the property names, and values are the column names.

Returns

IAsyncEnumerable<T>

The enumerable to pull the transformed results from.

Type Parameters

T

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

ResultsAsync<T>(DbCommand, 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>> ResultsAsync<T>(this DbCommand command, IEnumerable<KeyValuePair<string, string?>>? fieldMappingOverrides = null, bool useReadAsync = true, CancellationToken cancellationToken = default) where T : new()

Parameters

command DbCommand

The command to generate a reader 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).

ResultsAsync<T>(DbCommand, IEnumerable<KeyValuePair<string, string?>>?, CancellationToken)

Asynchronously returns all records and iteratively attempts to map the fields to type T.

public static ValueTask<IEnumerable<T>> ResultsAsync<T>(this DbCommand command, IEnumerable<KeyValuePair<string, string?>>? fieldMappingOverrides, CancellationToken cancellationToken = default) where T : new()

Parameters

command DbCommand

The command to generate a reader 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).

ResultsAsync<T>(DbCommand, 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>> ResultsAsync<T>(this DbCommand command, CancellationToken cancellationToken, params IEnumerable<KeyValuePair<string, string?>>? fieldMappingOverrides) where T : new()

Parameters

command DbCommand

The command to generate a reader 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).

ResultsAsync<T>(DbCommand, CancellationToken)

Asynchronously returns all records and iteratively attempts to map the fields to type T.

public static ValueTask<IEnumerable<T>> ResultsAsync<T>(this DbCommand command, CancellationToken cancellationToken) where T : new()

Parameters

command DbCommand

The command to generate a reader from.

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).

ResultsAsync<T>(DbCommand, 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>> ResultsAsync<T>(this DbCommand command, IEnumerable<(string Field, string? Column)>? fieldMappingOverrides = null, bool useReadAsync = true, CancellationToken cancellationToken = default) where T : new()

Parameters

command DbCommand

The command to generate a reader 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).

ResultsAsync<T>(DbCommand, IEnumerable<(string Field, string? Column)>?, CancellationToken)

Asynchronously returns all records and iteratively attempts to map the fields to type T.

public static ValueTask<IEnumerable<T>> ResultsAsync<T>(this DbCommand command, IEnumerable<(string Field, string? Column)>? fieldMappingOverrides, CancellationToken cancellationToken = default) where T : new()

Parameters

command DbCommand

The command to generate a reader 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.

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).

ResultsAsync<T>(DbCommand, CancellationToken, params (string Field, string? Column)[])

Asynchronously returns all records and iteratively attempts to map the fields to type T.

public static ValueTask<IEnumerable<T>> ResultsAsync<T>(this DbCommand command, CancellationToken cancellationToken, params (string Field, string? Column)[] fieldMappingOverrides) where T : new()

Parameters

command DbCommand

The command to generate a reader from.

cancellationToken CancellationToken

Optional cancellation token.

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