Constructor ExpressiveSqlCommand
- Namespace
- Open.Database.Extensions
- Assembly
- Open.Database.Extensions.MSSqlClient.dll
ExpressiveSqlCommand(IDbConnectionPool<SqlConnection>, CommandType, string, IEnumerable<Param>?)
Constructs a command that takes its connections from a connection pool.
public ExpressiveSqlCommand(IDbConnectionPool<SqlConnection> connectionPool, CommandType type, string command, IEnumerable<ExpressiveCommandBase<SqlConnection, SqlCommand, SqlDataReader, SqlDbType, ExpressiveSqlCommand>.Param>? @params = null)
Parameters
connectionPoolIDbConnectionPool<SqlConnection>The pool to take connections from. Each execution takes one and gives it back when finished.
typeCommandTypeThe command type.
commandstringThe command text, or the stored procedure name when
typeis StoredProcedure.paramsIEnumerable<ExpressiveCommandBase<SqlConnection, SqlCommand, SqlDataReader, SqlDbType, ExpressiveSqlCommand>.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.
ExpressiveSqlCommand(IDbConnectionFactory<SqlConnection>, CommandType, string, IEnumerable<Param>?)
Constructs a command that creates a new connection from a connection factory for each execution.
public ExpressiveSqlCommand(IDbConnectionFactory<SqlConnection> connFactory, CommandType type, string command, IEnumerable<ExpressiveCommandBase<SqlConnection, SqlCommand, SqlDataReader, SqlDbType, ExpressiveSqlCommand>.Param>? @params = null)
Parameters
connFactoryIDbConnectionFactory<SqlConnection>The 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<SqlConnection, SqlCommand, SqlDataReader, SqlDbType, ExpressiveSqlCommand>.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.
ExpressiveSqlCommand(SqlConnection, IDbTransaction?, CommandType, string, IEnumerable<Param>?)
Constructs a command that executes on an existing connection, optionally within a transaction.
public ExpressiveSqlCommand(SqlConnection connection, IDbTransaction? transaction, CommandType type, string command, IEnumerable<ExpressiveCommandBase<SqlConnection, SqlCommand, SqlDataReader, SqlDbType, ExpressiveSqlCommand>.Param>? @params = null)
Parameters
connectionSqlConnectionThe 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<SqlConnection, SqlCommand, SqlDataReader, SqlDbType, ExpressiveSqlCommand>.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.
ExpressiveSqlCommand(SqlConnection, CommandType, string, IEnumerable<Param>?)
Constructs a command that executes on an existing connection.
public ExpressiveSqlCommand(SqlConnection connection, CommandType type, string command, IEnumerable<ExpressiveCommandBase<SqlConnection, SqlCommand, SqlDataReader, SqlDbType, ExpressiveSqlCommand>.Param>? @params = null)
Parameters
connectionSqlConnectionThe 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<SqlConnection, SqlCommand, SqlDataReader, SqlDbType, ExpressiveSqlCommand>.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.
ExpressiveSqlCommand(IDbTransaction, CommandType, string, IEnumerable<Param>?)
Constructs a command that executes within a transaction, on the transaction's connection.
public ExpressiveSqlCommand(IDbTransaction transaction, CommandType type, string command, IEnumerable<ExpressiveCommandBase<SqlConnection, SqlCommand, SqlDataReader, SqlDbType, ExpressiveSqlCommand>.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<SqlConnection, SqlCommand, SqlDataReader, SqlDbType, ExpressiveSqlCommand>.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.