Constructor ExpressiveCommand
- Namespace
- Open.Database.Extensions
- Assembly
- Open.Database.Extensions.Core.dll
ExpressiveCommand(IDbConnectionPool, CommandType, string, IEnumerable<Param>?)
Constructs a command that takes its connections from a connection pool.
public ExpressiveCommand(IDbConnectionPool connectionPool, CommandType type, string command, IEnumerable<ExpressiveCommandBase<IDbConnection, IDbCommand, IDataReader, DbType, ExpressiveCommand>.Param>? @params = null)
Parameters
connectionPoolIDbConnectionPoolThe pool to take connections from. Each execution takes one and gives it back when finished.
typeCommandTypeThe command type.
commandstringThe command text or stored procedure name.
paramsIEnumerable<ExpressiveCommandBase<IDbConnection, IDbCommand, IDataReader, DbType, ExpressiveCommand>.Param>The initial parameters. They are copied, so later changes to the source collection do not affect the command.
Exceptions
- ArgumentNullException
connectionPoolorcommandis null.- ArgumentException
commandis empty or white space.
ExpressiveCommand(IDbConnectionFactory, CommandType, string, IEnumerable<Param>?)
Constructs a command that creates a new connection from a connection factory for each execution.
public ExpressiveCommand(IDbConnectionFactory connFactory, CommandType type, string command, IEnumerable<ExpressiveCommandBase<IDbConnection, IDbCommand, IDataReader, DbType, ExpressiveCommand>.Param>? @params = null)
Parameters
connFactoryIDbConnectionFactoryThe factory that creates the connections. Each execution creates a connection, opens it if needed, and disposes it when finished.
typeCommandTypeThe command type.
commandstringThe command text, or the stored procedure name when
typeis StoredProcedure.paramsIEnumerable<ExpressiveCommandBase<IDbConnection, IDbCommand, IDataReader, DbType, ExpressiveCommand>.Param>The initial parameters. They are copied, so later changes to the source collection do not affect the command.
Exceptions
- ArgumentNullException
connFactoryorcommandis null.- ArgumentException
commandis empty or white space.
ExpressiveCommand(Func<IDbConnection>, CommandType, string, IEnumerable<Param>?)
Constructs a command that invokes a function to create a new connection for each execution.
public ExpressiveCommand(Func<IDbConnection> connFactory, CommandType type, string command, IEnumerable<ExpressiveCommandBase<IDbConnection, IDbCommand, IDataReader, DbType, ExpressiveCommand>.Param>? @params = null)
Parameters
connFactoryFunc<IDbConnection>The function that creates the connections. Each execution invokes it, opens the connection if needed, and disposes it when finished.
typeCommandTypeThe command type.
commandstringThe command text, or the stored procedure name when
typeis StoredProcedure.paramsIEnumerable<ExpressiveCommandBase<IDbConnection, IDbCommand, IDataReader, DbType, ExpressiveCommand>.Param>The initial parameters. They are copied, so later changes to the source collection do not affect the command.
Exceptions
- ArgumentNullException
connFactoryorcommandis null.- ArgumentException
commandis empty or white space.
ExpressiveCommand(IDbConnection, IDbTransaction?, CommandType, string, IEnumerable<Param>?)
Constructs a command that executes on an existing connection, optionally within a transaction.
public ExpressiveCommand(IDbConnection connection, IDbTransaction? transaction, CommandType type, string command, IEnumerable<ExpressiveCommandBase<IDbConnection, IDbCommand, IDataReader, DbType, ExpressiveCommand>.Param>? @params = null)
Parameters
connectionIDbConnectionThe connection to execute on. It is opened only if it is closed, closed again afterwards if the command opened it, and never disposed.
transactionIDbTransactionThe optional transaction to execute the command in.
typeCommandTypeThe command type.
commandstringThe command text, or the stored procedure name when
typeis StoredProcedure.paramsIEnumerable<ExpressiveCommandBase<IDbConnection, IDbCommand, IDataReader, DbType, ExpressiveCommand>.Param>The initial parameters. They are copied, so later changes to the source collection do not affect the command.
Exceptions
- ArgumentNullException
connectionorcommandis null.- ArgumentException
commandis empty or white space.
ExpressiveCommand(IDbTransaction, CommandType, string, IEnumerable<Param>?)
Constructs a command that executes within a transaction, on the transaction's connection.
public ExpressiveCommand(IDbTransaction transaction, CommandType type, string command, IEnumerable<ExpressiveCommandBase<IDbConnection, IDbCommand, IDataReader, DbType, ExpressiveCommand>.Param>? @params = null)
Parameters
transactionIDbTransactionThe transaction to execute the command in. Its Connection is used for execution.
typeCommandTypeThe command type.
commandstringThe command text, or the stored procedure name when
typeis StoredProcedure.paramsIEnumerable<ExpressiveCommandBase<IDbConnection, IDbCommand, IDataReader, DbType, ExpressiveCommand>.Param>The initial parameters. They are copied, so later changes to the source collection do not affect the command.
Exceptions
- ArgumentNullException
transactionorcommandis null.- ArgumentException
commandis empty or white space.
ExpressiveCommand(IDbConnection, CommandType, string, IEnumerable<Param>?)
Constructs a command that executes on an existing connection.
public ExpressiveCommand(IDbConnection connection, CommandType type, string command, IEnumerable<ExpressiveCommandBase<IDbConnection, IDbCommand, IDataReader, DbType, ExpressiveCommand>.Param>? @params = null)
Parameters
connectionIDbConnectionThe connection to execute on. It is opened only if it is closed, closed again afterwards if the command opened it, and never disposed.
typeCommandTypeThe command type.
commandstringThe command text, or the stored procedure name when
typeis StoredProcedure.paramsIEnumerable<ExpressiveCommandBase<IDbConnection, IDbCommand, IDataReader, DbType, ExpressiveCommand>.Param>The initial parameters. They are copied, so later changes to the source collection do not affect the command.
Exceptions
- ArgumentNullException
connectionorcommandis null.- ArgumentException
commandis empty or white space.