Namespace Open.Database.Extensions
Extensions on the standard ADO.NET types, expressive commands and row mapping. This is the namespace most applications use.
- The foundation: extension methods on connections, commands, readers and transactions, for example ConnectionExtensions, CommandExtensions and TransactionExtensions.
- Connection factories: IDbConnectionFactory and DbConnectionFactory.
- Expressive commands: ExpressiveCommand and ExpressiveDbCommand, started with
Command(sql)orStoredProcedure(name). - Row mapping:
Map<T>()in CoreExtensions returns a deferred MappedQuery<T>. - Companion packages: the Channel, Dataflow and MSSqlClient packages add their types to this namespace.
The guide has the narrative: The foundation, Expressive commands and Mapping rows to objects.
Classes
- BoundCallExtensions
The terminals of a BoundCall<TKind>: a scalar call has
ExecuteScalarAsync, a write hasExecuteNonQueryAsync.
- ChannelDbExtensions
Rows from a mapped query into a channel.
- CommandExtensions
Provides extension methods that execute a command and read its results.
- ConnectionExtensions
Extension methods on connections, transactions, connection factories and connection pools that start an expressive command, create commands, ensure a connection is open, and run work on a connection.
- ConnectionPoolExtensions
Extensions for converting a non-generic connection pool into a generic one.
- CoreExtensions
Core extensions, not specific to a database provider, for building a command and retrieving data.
- DataReaderExtensions
Provides extension methods that read rows and result sets from an IDataReader or DbDataReader.
- DataRecordExtensions
Extension methods for reading column names, data type names, ordinals, and values from an IDataRecord, such as a data reader positioned on a row.
- DataflowExtensions
Extensions that read the rows of a mapped query into a Dataflow block.
- DbConnectionFactory
A connection factory implementation backed by a factory function.
- DbConnectionFactoryExtensions
Extensions for presenting a connection factory as a pool or as a generic factory.
- DbConnectionFactory<TConnection>
A strongly typed connection factory implementation backed by a factory function.
- DbNonQuery
A write defined once: the command text (or stored procedure name) and its timeout, with no connection. Immutable and safe to keep in a static field and share.
- DbNonQuery<TParams>
A DbNonQuery that declared the type of its values.
- DbQuery
Represents a query defined once: the command text (or stored procedure name) and its timeout, with no connection. Immutable and safe to keep in a static field and share.
- DbQuery<TParams>
Represents a DbQuery that declared the type of its values.
- ExpressiveCommand
A deferred, fluent command for running SQL through any IDbConnection, IDbTransaction, connection factory, or connection pool; nothing runs until an execute method is called.
- ExpressiveCommandBase<TConnection, TCommand, TReader, TDbType, TThis>
Represents the base class of the expressive commands, for use with IDbConnection and IDbCommand types.
- ExpressiveDbCommand
A deferred, fluent command for running SQL through any DbConnection, DbTransaction, connection factory, or connection pool, whose callbacks receive the DbCommand and DbDataReader.
- ExpressiveDbCommandBase<TConnection, TCommand, TReader, TDbType, TThis>
Represents the base class of the expressive commands that execute on a database with the asynchronous ADO.NET APIs, for use with DbConnection and DbCommand types.
- ExpressiveSqlCommand
A deferred, fluent command for running SQL through a SqlConnection, SqlTransaction, connection factory, or connection pool, with parameters typed by SqlDbType.
- MappedDbQueryExtensions
Adds parameters to a MappedQuery<T> made from a DbQuery definition.
- MappedDbQuery<T>
A DbQuery that is already mapped: the command text, the kind, the timeout, the map that turns a row into a
T, and the options that never change from one call to the next. It has no connection yet and cannot be read until it has one.
- MappedDbQuery<TParams, T>
A MappedDbQuery<T> whose parameters are one typed struct, so the compiler checks them.
- NullPolicyAttribute
Declares what a NULL does to a member when a row is mapped: on the model type for every member, or on one member.
- NullValueAttribute
Declares the value a NULL gives a member when a row is mapped: the member is checked for NULL, and a NULL is replaced with the value.
- PooledArray<T>
The complete result of a PooledBuffer<T>: a read-only list over its pooled arrays.
- PooledBuffer<T>
Holds every row of a query in pooled arrays until the buffer is disposed.
- RowMap
The builder behind the collection syntax of RowMap<T>:
RowMap<Post> map = [new(nameof(Post.Id), "post_id")];.
- RowMap<T>
Represents a validated, read-only mapping of the properties and constructor parameters of
Tto the columns that feed them.
- ScalarDbQuery<T>
A query defined once that reads one value: the first column of the first row, as a
T. It has no connection yet.
- ScalarDbQuery<TParams, T>
A ScalarDbQuery<T> whose values are one typed struct, so the compiler checks them.
- SqlCommandExtensions
Provides extension methods that execute a SqlCommand and read its results, and that add typed parameters to it.
- SqlConnectionExtensions
Extension methods that create an ExpressiveSqlCommand or a SqlCommand from a connection, transaction, connection factory, connection pool, or factory function.
- SqlConnectionFactory
A connection factory that creates a new SqlConnection each time it is asked, either from a factory function or from a connection string.
- SqlTransactionExtensions
Provides Microsoft.Data.SqlClient specific extension methods that run work in a database transaction on a SqlConnection.
- TransactionExtensions
Extension methods for database transactions that do not depend on a specific database provider.
- ValueMappingException
The exception that is thrown when a column value cannot be mapped to the requested .NET type: a value that does not convert, an overflow, and so on.
Structs
- BoundCall<TKind>
A scalar query or a write bound to where its connections come from, with the values added so far.
- BoundParams<TKind, TParams>
A scalar query or a write with typed values that has a source and waits for the values.
- ColumnOrdinal
A column of a result set: its name and its ordinal.
- ConfiguredConnectionScope<TConnection>
A ConnectionScope<TConnection> whose disposal is awaited as configured by ConfigureAwait(bool).
- ConnectionScope<TConnection>
A connection that was opened if it needed to be, the state it was found in, and what to do with it when the scope is disposed.
- DbQueryCall
Represents a DbQuery bound to a source with some values added. A readonly struct: each
AddParamreturns a new one and leaves this one unchanged, so a call can be kept and branched.
- DbQueryUsing
Represents a DbQuery bound to where its connections come from.
- DbQueryUsing<TParams>
Represents a DbQuery<TParams> bound to where its connections come from. The values are given in one call, checked at compile time.
- DictionaryRow
One row of a result set read without a model: the values of the row and, by name, the columns they came from.
- DictionaryRow.Enumerator
Enumerates the distinct names of a DictionaryRow with their values.
- ExpressiveCommandBase<TConnection, TCommand, TReader, TDbType, TThis>.Param
A parameter to be created on the database command each time the expressive command executes.
- MappedCommand<T>
A deferred, type-locked query over a raw IDbCommand. Terminals are methods here.
- MappedDbQueryUsing<TParams, T>
A typed mapped query that has a source and waits for its parameters.
- MappedQueryWithSkip<T>
A MappedQuery<T> with a pending skip; can still be limited with Take(int).
- MappedQueryWithTake<T>
A MappedQuery<T> with a take (and any preceding skip), ready for a terminal.
- MappedQuery<T>
A deferred, type-locked query over any IExecuteReader. Terminals are methods here.
- MappedReader<T>
A deferred, type-locked read over a data reader the caller owns. Terminals are methods here.
- MappedTable<T>
A deferred, type-locked read over the rows of a DataTable. Terminals are methods here.
- NonQueryKind
Marks a chain that writes: it ends in
ExecuteNonQueryAsync.
- PendingCall<TKind>
The values of a scalar query or a write, added before it has a source. It has no terminal:
Usinggives it a source.
- PendingParams<TKind, TParams>
The typed values of a scalar query or a write, added before it has a source. It has no terminal:
Usinggives it a source.
- PooledArray<T>.Enumerator
Walks the rows of a PooledArray<T>, chunk by chunk, straight over the arrays behind them.
- ScalarKind<T>
Marks a chain that reads one value: it ends in
ExecuteScalarAsync.
- UnboundCall<T>
The parameters of a MappedDbQuery<T>, added before it has a source. It has no terminals: it cannot be read until
Usinggives it a source.
- UnboundCall<TParams, T>
The typed parameters of a MappedDbQuery<TParams, T>, added before it has a source. It has no terminals: it cannot be read until
Usinggives it a source.
Interfaces
- IDbConnectionFactory
A common abstraction for creating database connections. Can easily be used with dependency injection.
- IDbConnectionFactory<TConnection>
A strongly typed IDbConnectionFactory that creates connections of type
TConnection.
- IDbConnectionPool
A common abstraction for acquiring and releasing database connections. Can easily be used with dependency injection.
- IDbConnectionPool<TConnection>
A strongly typed IDbConnectionPool that provides connections of type
TConnection.
- IExecuteCommand
Executes work against an IDbCommand that the implementation creates, runs, and cleans up for the caller.
- IExecuteCommand<TCommand>
A strongly typed IExecuteCommand whose commands are of type
TCommand.
- IExecuteReader
Represents an expressive command that runs a data reader and hands it to a function of the caller.
- IExecuteReaderAsync
Represents an expressive command that can read the rows of its data reader asynchronously.
- IExecuteReaderAsync<TReader>
Represents an expressive command whose data reader is of type
TReaderand that can read its rows asynchronously.
- IExecuteReader<TReader>
Represents an expressive command whose data reader is of type
TReader.
- IMappedQuery<T>
A query that reads its rows into a channel or a block feed, or one at a time.
Enums
- NullAction
What a NullPolicyAttribute does when a member's column is NULL.