Class ExpressiveDbCommandBase<TConnection, TCommand, TReader, TDbType, TThis>
- Namespace
- Open.Database.Extensions
- Assembly
- Open.Database.Extensions.Core.dll
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.
public abstract class ExpressiveDbCommandBase<TConnection, TCommand, TReader, TDbType, TThis> : ExpressiveCommandBase<TConnection, TCommand, TReader, TDbType, TThis>, IExecuteCommand<TCommand>, IExecuteCommand, IExecuteReaderAsync<TReader>, IExecuteReaderAsync, IExecuteReader<TReader>, IExecuteReader where TConnection : DbConnection where TCommand : DbCommand where TReader : DbDataReader where TDbType : struct where TThis : ExpressiveDbCommandBase<TConnection, TCommand, TReader, TDbType, TThis>
Type Parameters
TConnectionThe type of the connection to be used.
TCommandThe type of the commands generated by the connection.
TReaderThe type of reader created by the command.
TDbTypeThe DB type enum to use for parameters.
TThisThe type of the derived class, so that the chaining methods return it.
- Inheritance
-
ExpressiveCommandBase<TConnection, TCommand, TReader, TDbType, TThis>ExpressiveDbCommandBase<TConnection, TCommand, TReader, TDbType, TThis>
- Implements
-
IExecuteCommand<TCommand>IExecuteReaderAsync<TReader>IExecuteReader<TReader>
- Derived
- Inherited Members
- Extension Methods
Constructors
- ExpressiveDbCommandBase(IDbConnectionFactory<TConnection>, CommandType, string, IEnumerable<Param>?)
Initializes a new instance that creates a new connection from a connection factory for each execution.
- ExpressiveDbCommandBase(IDbConnectionPool<TConnection>, CommandType, string, IEnumerable<Param>?)
Initializes a new instance that takes its connections from a connection pool.
- ExpressiveDbCommandBase(IDbTransaction, CommandType, string, IEnumerable<Param>?)
Initializes a new instance that executes within a transaction, on the transaction's connection.
- ExpressiveDbCommandBase(Func<TConnection>, CommandType, string, IEnumerable<Param>?)
Initializes a new instance that invokes a function to create a new connection for each execution.
- ExpressiveDbCommandBase(TConnection, CommandType, string, IEnumerable<Param>?)
Initializes a new instance that executes on an existing connection.
- ExpressiveDbCommandBase(TConnection, IDbTransaction?, CommandType, string, IEnumerable<Param>?)
Initializes a new instance that executes on an existing connection, optionally within a transaction.
Methods
- AsyncReads()
Reads the rows of an async terminal with
ReadAsyncinstead ofRead, for this command.
- ExecuteNonQueryAsync(CancellationToken)
Asynchronously executes the command with ExecuteNonQueryAsync(CancellationToken).
- ExecuteScalarAsync(CancellationToken)
Asynchronously executes the command with ExecuteScalarAsync(CancellationToken).
- ExecuteScalarAsync<T>(Func<object?, ValueTask<T>>, CancellationToken)
Asynchronously executes the command with ExecuteScalarAsync(CancellationToken) and passes the value to an asynchronous transform.
- ExecuteScalarAsync<T>(Func<object?, T>, CancellationToken)
Asynchronously executes the command with ExecuteScalarAsync(CancellationToken) and passes the value to a transform.
- ExecuteScalarAsync<T>(CancellationToken)
Asynchronously executes the command with ExecuteScalarAsync(CancellationToken) and converts the value to the expected type, as
Map<T>()converts a column.