Class IExecuteReaderExtensions
- Namespace
- Open.Database.Extensions
- Assembly
- Open.Database.Extensions.Core.dll
Core non-DB-specific extensions for retrieving data from a command using best practices.
public static class IExecuteReaderExtensions
- Inheritance
-
IExecuteReaderExtensions
- Inherited Members
Methods
- FirstOrDefault<T>(IExecuteReader, Func<IDataRecord, T>)
Iterates an IDataReader and returns the first result through a transform function. Returns default(T) if none.
- FirstOrdinalResults(IExecuteReader)
Reads the first column from every record and returns the results as a list.. DBNull values are converted to null.
- FirstOrdinalResults<T0>(IExecuteReader)
Reads the first column from every record.. DBNull values are converted to null.
- First<T>(IExecuteReader, Func<IDataRecord, T>)
Iterates an IDataReader and returns the first result through a transform function. Throws if none.
- IterateReader(IExecuteReader, Action<IDataRecord>, CommandBehavior)
Iterates a reader on a command with a handler function.
- IterateReaderAsync(IExecuteReaderAsync, Action<IDataRecord>, CommandBehavior)
Iterates a reader on a command with a handler function.
- IterateReaderWhile(IExecuteReader, Func<IDataRecord, bool>, CommandBehavior)
Iterates a reader on a command while the handler function returns true.
- IterateReaderWhileAsync(IExecuteReaderAsync, Func<IDataRecord, bool>, CommandBehavior)
Iterates a reader on a command while the handler function returns true.
- IterateReaderWhileAsync(IExecuteReaderAsync, Func<IDataRecord, ValueTask<bool>>, CommandBehavior)
Iterates a reader on a command while the handler function returns true.
- IterateReader<TEntity, TResult>(IExecuteReader, Func<IDataRecord, TEntity>, Func<IEnumerable<TEntity>, TResult>, CommandBehavior)
Executes a reader on a command with a transform function.
- LoadTable(IExecuteReader)
Imports all data using an IDataReader into a DataTable.
- LoadTables(IExecuteReader)
Loads all data from a command through an IDataReader into a DataTables. Calls .NextResult() to check for more results.
- Results<T>(IExecuteReader, 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>(IExecuteReader, 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.
- Results<T>(IExecuteReader, params (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(IExecuteReader)
Iterates all records within the first result set using an IDataReader and returns the results. DBNull values are left unchanged (retained).
- Retrieve(IExecuteReader, IEnumerable<int>)
Iterates all records within the current result set using an IDataReader and returns the desired results. DBNull values are left unchanged (retained).
- Retrieve(IExecuteReader, IEnumerable<string>)
Iterates all records within the first result set using an IDataReader and returns the desired results as a list of Dictionaries containing only the specified column values. DBNull values are left unchanged (retained).
- Retrieve(IExecuteReader, int, params IEnumerable<int>)
Iterates all records within the current result set using an IDataReader and returns the desired results. DBNull values are left unchanged (retained).
- Retrieve(IExecuteReader, string, params IEnumerable<string>)
Iterates all records within the current result set using an IDataReader and returns the desired results. DBNull values are left unchanged (retained).
- SingleOrDefault<T>(IExecuteReader, Func<IDataRecord, T>)
Iterates an IDataReader and returns the first result through a transform function. Returns default(T) if none. Throws if more than one entry.
- Single<T>(IExecuteReader, Func<IDataRecord, T>)
Iterates a IDataReader and returns the first result through a transform function. Throws if none or more than one entry.
- SkipThenTake<T>(IExecuteReader, int, int, Func<IDataRecord, T>)
Iterates an IDataReader and skips by the skip parameter returns the maximum remaining defined by the take parameter.
- Skip<T>(IExecuteReader, int, Func<IDataRecord, T>)
Iterates an IDataReader and skips the first number of results defined by the count.
- Take<T>(IExecuteReader, int, Func<IDataRecord, T>)
Iterates an IDataReader and returns the first number of results defined by the count.
- ToArray<T>(IExecuteReader, Func<IDataRecord, T>, CommandBehavior)
Converts all IDataRecords into an array using a transform function.
- ToImmutableArray<T>(IExecuteReader, Func<IDataRecord, T>, CommandBehavior)
Converts all IDataRecords into an immutable array using a transform function.
- ToList<T>(IExecuteReader, Func<IDataRecord, T>, CommandBehavior)
Converts all IDataRecords into a list using a transform function.