Table of Contents

Class CoreExtensions

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

Core non-DB-specific extensions for building a command and retrieving data using best practices.

[SuppressMessage("Design", "CA1068:CancellationToken parameters must come last", Justification = "Internal function that requires a cancellation token.")]
public static class CoreExtensions
Inheritance
CoreExtensions
Inherited Members

Methods

AsEnumerable(DataColumnCollection)

Generic enumerable extension for DataColumnCollection.

AsEnumerable(DataRowCollection)

Generic enumerable extension for DataRowCollection.

CopyToDBNullAsNull(ReadOnlySpan<object?>, Memory<object?>)

Copies the contents of the values span to the target span with any DBNull values converted to null.

CopyToDBNullAsNull(ReadOnlySpan<object?>, Span<object?>)

Copies the contents of the values span to the target span with any DBNull values converted to null.

CopyToDBNullAsNull(Span<object?>, Memory<object?>)

Copies the contents of the values span to the target span with any DBNull values converted to null.

CopyToDBNullAsNull(Span<object?>, Span<object?>)

Copies the contents of the values span to the target span with any DBNull values converted to null.

DBNullToNull(IEnumerable<object?>)

Any DBNull values are yielded as null.

DBNullToNullCopy(object?[])

Returns a copy of values with any DBNull values converted to null.

DBNullToNullCopy(ReadOnlySpan<object?>)

Returns a copy of the contents of this span as an array with any DBNull values converted to null.

DBNullToNullCopy(Span<object?>)

Returns a copy of the contents of this span as an array with any DBNull values converted to null.

DequeueEach<T>(Queue<T>)

Useful extension for dequeuing items from a queue. Not thread safe but queueing/dequeuing items in between items is supported.

Map<T>(IExecuteReader)

Locks in a mapping to model type T and returns a deferred MappedQuery<T>. Nothing runs until a terminal (ToList/FirstOrDefault/…) is invoked. The mapping is compiled once per result-set shape and cached, so repeated queries pay no reflection or compilation cost; values are read with typed getters, so nothing is boxed.

Map<T>(IExecuteReader, params IEnumerable<KeyValuePair<string, string?>>?)

Locks in a mapping to model type T and returns a deferred MappedQuery<T>. Nothing runs until a terminal (ToList/FirstOrDefault/…) is invoked. The mapping is compiled once per result-set shape and cached, so repeated queries pay no reflection or compilation cost; values are read with typed getters, so nothing is boxed.

Map<T>(IExecuteReader, params IEnumerable<(string Field, string? Column)>?)

Locks in a mapping to model type T and returns a deferred MappedQuery<T>. Nothing runs until a terminal (ToList/FirstOrDefault/…) is invoked. The mapping is compiled once per result-set shape and cached, so repeated queries pay no reflection or compilation cost; values are read with typed getters, so nothing is boxed.

Map<T>(IExecuteReader, Func<IDataRecord, T>)

Locks in a custom projection and returns a deferred MappedQuery<T>. Nothing runs until a terminal is invoked; selector is applied per row as the reader streams.

ReplaceDBNullWithNull(List<object?>)

Replaces any DBNull in the values with null;

ReplaceDBNullWithNull(Memory<object?>)

Replaces any DBNull in the values with null;

ReplaceDBNullWithNull(object?[])

Replaces any DBNull in the values with null;

ReplaceDBNullWithNull(Span<object?>)

Replaces any DBNull in the values with null;

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

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

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

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

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

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

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

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

ResultsAsync<T>(DbCommand, CancellationToken)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

ResultsBuffered<T>(IDataReader)

Iterates each record and attempts to map the fields to type T. Data is temporarily stored (buffered in entirety) in a queue before applying the transform for each iteration.

ResultsBuffered<T>(IDataReader, params IEnumerable<KeyValuePair<string, string?>>?)

Iterates each record and attempts to map the fields to type T. Data is temporarily stored (buffered in entirety) in a queue before applying the transform for each iteration.

ResultsBuffered<T>(IDataReader, params IEnumerable<(string Field, string? Column)>?)

Iterates each record and attempts to map the fields to type T. Data is temporarily stored (buffered in entirety) in a queue before applying the transform for each iteration.

ResultsFromDataTable<T>(IDataReader, IEnumerable<KeyValuePair<string, string?>>?)

Loads all data into a DataTable before Iterates each record and attempts to map the fields to type T. Data is temporarily stored (buffered in entirety) in a queue before applying the transform for each iteration.

ResultsFromDataTable<T>(IDataReader, params IEnumerable<(string Field, string? Column)>?)

Loads all data into a DataTable before Iterates each record and attempts to map the fields to type T. Data is temporarily stored (buffered in entirety) in a queue before applying the transform for each iteration.

ResultsFromDataTable<T>(IDbCommand, IEnumerable<KeyValuePair<string, string?>>?)

Loads all data into a DataTable before Iterates each record and attempts to map the fields to type T. Data is temporarily stored (buffered in entirety) in a queue before applying the transform for each iteration.

ResultsFromDataTable<T>(IDbCommand, params IEnumerable<(string Field, string? Column)>?)

Loads all data into a DataTable before Iterates each record and attempts to map the fields to type T. Data is temporarily stored (buffered in entirety) in a queue before applying the transform for each iteration.

Results<T>(IDataReader)

Iterates each record and attempts to map the fields to type T.

Results<T>(IDataReader, params IEnumerable<KeyValuePair<string, string?>>?)

Iterates each record and attempts to map the fields to type T.

Results<T>(IDataReader, params IEnumerable<(string Field, string? Column)>?)

Iterates each record and attempts to map the fields to type T.

Results<T>(IDbCommand)

Iterates each record and attempts to map the fields to type T. Data is temporarily stored (buffered in entirety) in a queue before applying the transform for each iteration.

Results<T>(IDbCommand, params IEnumerable<KeyValuePair<string, string?>>?)

Iterates each record and attempts to map the fields to type T. Data is temporarily stored (buffered in entirety) in a queue before applying the transform for each iteration.

Results<T>(IDbCommand, params IEnumerable<(string Field, string? Column)>?)

Iterates each record and attempts to map the fields to type T. Data is temporarily stored (buffered in entirety) in a queue before applying the transform for each iteration.

Retrieve(IDataReader)

Iterates all records within the current result set using an IDataReader and returns the desired results.

Retrieve(IDataReader, IEnumerable<int>)

Iterates all records within the current result set using an IDataReader and returns the desired results.

Retrieve(IDataReader, IEnumerable<string>)

Iterates all records within the current result set using an IDataReader and returns the desired results.

Retrieve(IDataReader, int, params IEnumerable<int>)

Iterates all records within the current result set using an IDataReader and returns the desired results.

Retrieve(IDataReader, string, params IEnumerable<string>)

Iterates all records within the current result set using an IDataReader and returns the desired results.

Retrieve(IDbCommand, IEnumerable<int>)

Executes a reader and iterates all records within the remaining result set using an IDataReader and returns the desired results.

Retrieve(IDbCommand, IEnumerable<string>)

Executes a reader and iterates all records within the remaining result set using an IDataReader and returns the desired results.

Retrieve(IDbCommand, CommandBehavior)

Executes a reader and iterates all records within the remaining result set using an IDataReader and returns the desired results.

Retrieve(IDbCommand, int, params IEnumerable<int>)

Executes a reader and iterates all records within the remaining result set using an IDataReader and returns the desired results.

Retrieve(IDbCommand, string, params IEnumerable<string>)

Executes a reader and iterates all records within the remaining result set using an IDataReader and returns the desired results.

RetrieveAsync(DbCommand, bool, CancellationToken)

Asynchronously executes a reader and enumerates all the remaining values of the current result set and returns the desired results.

RetrieveAsync(DbCommand, IEnumerable<int>, bool, CancellationToken)

Asynchronously executes a reader and enumerates all the remaining values of the current result set and returns the desired results.

RetrieveAsync(DbCommand, IEnumerable<int>, CancellationToken)

Asynchronously executes a reader and enumerates all the remaining values of the current result set and returns the desired results.

RetrieveAsync(DbCommand, IEnumerable<string>, bool, bool, CancellationToken)

Asynchronously executes a reader and enumerates all the remaining values of the current result set and returns the desired results.

RetrieveAsync(DbCommand, IEnumerable<string>, bool, CancellationToken)

Asynchronously executes a reader and enumerates all the remaining values of the current result set and returns the desired results.

RetrieveAsync(DbCommand, IEnumerable<string>, CancellationToken)

Asynchronously executes a reader and enumerates all the remaining values of the current result set and returns the desired results.

RetrieveAsync(DbCommand, int, params IEnumerable<int>)

Asynchronously executes a reader and enumerates all the remaining values of the current result set and returns the desired results.

RetrieveAsync(DbCommand, string, params IEnumerable<string>)

Asynchronously executes a reader and enumerates all the remaining values of the current result set and returns the desired results.

RetrieveAsync(DbCommand, CancellationToken)

Asynchronously executes a reader and enumerates all the remaining values of the current result set and returns the desired results.

RetrieveAsync(DbCommand, CancellationToken, int, params IEnumerable<int>)

Asynchronously executes a reader and enumerates all the remaining values of the current result set and returns the desired results.

RetrieveAsync(DbCommand, CancellationToken, string, params IEnumerable<string>)

Asynchronously executes a reader and enumerates all the remaining values of the current result set and returns the desired results.

RetrieveAsync(DbDataReader, bool, CancellationToken)

Asynchronously enumerates all records within the current result set using an DbDataReader and returns the desired results.

RetrieveAsync(DbDataReader, IEnumerable<int>, bool, CancellationToken)

Asynchronously enumerates all records within the current result set using an DbDataReader and returns the desired results.

RetrieveAsync(DbDataReader, IEnumerable<int>, CancellationToken)

Asynchronously enumerates all records within the current result set using an DbDataReader and returns the desired results.

RetrieveAsync(DbDataReader, IEnumerable<string>, bool, bool, CancellationToken)

Asynchronously enumerates all records within the current result set using an DbDataReader and returns the desired results.

RetrieveAsync(DbDataReader, IEnumerable<string>, bool, CancellationToken)

Asynchronously enumerates all records within the current result set using an DbDataReader and returns the desired results.

RetrieveAsync(DbDataReader, IEnumerable<string>, CancellationToken)

Asynchronously enumerates all records within the current result set using an DbDataReader and returns the desired results.

RetrieveAsync(DbDataReader, int, params IEnumerable<int>)

Asynchronously enumerates all records within the current result set using an DbDataReader and returns the desired results.

RetrieveAsync(DbDataReader, string, params IEnumerable<string>)

Asynchronously enumerates all records within the current result set using an DbDataReader and returns the desired results.

RetrieveAsync(DbDataReader, CancellationToken)

Asynchronously enumerates all records within the current result set using an DbDataReader and returns the desired results.

RetrieveAsync(DbDataReader, CancellationToken, int, params IEnumerable<int>)

Asynchronously enumerates all records within the current result set using an DbDataReader and returns the desired results.

RetrieveAsync(DbDataReader, CancellationToken, string, params IEnumerable<string>)

Asynchronously enumerates all records within the current result set using an DbDataReader and returns the desired results.

To<T>(DataTable, params IEnumerable<KeyValuePair<string, string?>>?)

Loads all data into a queue before iterating (dequeuing) the results as type T.

To<T>(DataTable, IEnumerable<KeyValuePair<string, string?>>?, bool)

Loads all data into a queue before iterating (dequeuing) the results as type T.

To<T>(DataTable, params IEnumerable<(string Field, string? Column)>?)

Loads all data into a queue before iterating (dequeuing) the results as type T.

To<T>(DataTable, IEnumerable<(string Field, string? Column)>?, bool)

Loads all data into a queue before iterating (dequeuing) the results as type T.