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
- ChannelDbExtensions
Extensions for writing data to a channel.
- CommandExtensions
Core non-DB-specific extensions for retrieving data from a command using best practices.
- ConnectionExtensions
Core non-DB-specific extensions for database connections.
- ConnectionPoolExtensions
Extensions for converting a non-generic connection pool into a generic one.
- CoreExtensions
Core non-DB-specific extensions for building a command and retrieving data using best practices.
- DataReaderExtensions
Extension methods for Data Readers.
- 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 for pipelining data with Dataflow blocks.
- DbConnectionFactory
A connection factory implementation backed by a factory function. Use Create<TConnection>(Func<TConnection>) or the implicit conversion from Func<TResult> to build one.
- 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.
- ExpressiveCommand
A deferred, fluent command for running SQL through any IDbConnection, IDbTransaction, connection factory, or connection pool. Nothing touches the database until an execute method is called.
- ExpressiveCommandBase<TConnection, TCommand, TReader, TDbType, TThis>
Base class for developing expressive commands. Includes methods for use with IDbConnection and IDbCommand types.
- ExpressiveDbCommand
A deferred, fluent command for running SQL through any DbConnection, DbTransaction, connection factory, or connection pool. Unlike ExpressiveCommand, it exposes the DbCommand and DbDataReader types to the callbacks, so the provider-agnostic asynchronous ADO.NET APIs are available without casting.
- ExpressiveDbCommandBase<TConnection, TCommand, TReader, TDbType, TThis>
An base class for executing commands on a database using best practices and simplified expressive syntax. Includes methods 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. Nothing touches the database until an execute method is called.
- IExecuteReaderExtensions
Core non-DB-specific extensions for retrieving data from a command using best practices.
- MappedQueryExtensions
Terminal operations for IMappedQuery<T>: they materialize the mapped rows into a collection or take a single row. MappedQuery<T> and its skip and take variants expose the same operations directly.
- SqlCommandExtensions
SqlClient extensions for building a command and retrieving data using best practices.
- SqlConnectionExtensions
Extensions for SqlConnections.
- 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
Microsoft.Data.SqlClient specific extensions for database transactions.
- TransactionExtensions
Core non-DB-specific extensions for database transactions.
Structs
- DbConnectionFactoryExtensions.ConnectionFactoryToPoolAdapter
Presents a connection factory function as an IDbConnectionPool: taking a connection invokes the function and giving it back disposes it.
- DbConnectionFactoryExtensions.ConnectionFactoryToPoolAdapter<TConnection>
Presents a typed connection factory function as an IDbConnectionPool<TConnection>: taking a connection invokes the function and giving it back disposes it.
- ExpressiveCommandBase<TConnection, TCommand, TReader, TDbType, TThis>.Param
A parameter to be created on the database command each time the expressive command executes.
TDbTypeaccommodates the difference between DbType and provider-specific enums such asSqlDbType.
- MappedQueryWithSkip<T>
A MappedQuery<T> with a pending skip; can still be limited with Take(int).
- MappedQueryWithTake<T>
A fully-configured MappedQuery<T> with a take (and any preceding skip); terminal-only.
- MappedQuery<T>
A deferred, type-locked query over any IExecuteReader. Terminals are methods here, with more as extensions on IMappedQuery<T>.
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
Common interface used for expressive commands when dealing with a data reader.
- IExecuteReaderAsync
Common interface used for expressive commands when dealing with a data reader.
- IExecuteReaderAsync<TReader>
Common interface used for expressive commands when dealing with a data reader.
- IExecuteReader<TReader>
Common interface used for expressive commands when dealing with a data reader.
- IMappedQuery<T>
A deferred query whose rows are mapped to
T. Nothing runs until one of the terminal methods is called.