Table of Contents

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

connectionPool IDbConnectionPool<SqlConnection>

The pool to take connections from. Each execution takes one and gives it back when finished.

type CommandType

The command type.

command string

The command text, or the stored procedure name when type is StoredProcedure.

params IEnumerable<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

connectionPool or command is null.

ArgumentException

command is 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

connFactory IDbConnectionFactory<SqlConnection>

The factory that creates the connections. Each execution creates a connection, opens it if needed, and disposes it when finished.

type CommandType

The command type.

command string

The command text, or the stored procedure name when type is StoredProcedure.

params IEnumerable<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

connFactory or command is null.

ArgumentException

command is 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

connection SqlConnection

The connection to execute on. It is opened only if it is closed, closed again afterwards if the command opened it, and never disposed.

transaction IDbTransaction

The optional transaction to execute the command in.

type CommandType

The command type.

command string

The command text, or the stored procedure name when type is StoredProcedure.

params IEnumerable<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

connection or command is null.

ArgumentException

command is 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

connection SqlConnection

The connection to execute on. It is opened only if it is closed, closed again afterwards if the command opened it, and never disposed.

type CommandType

The command type.

command string

The command text, or the stored procedure name when type is StoredProcedure.

params IEnumerable<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

connection or command is null.

ArgumentException

command is 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

transaction IDbTransaction

The transaction to execute the command in. Its Connection is used for execution.

type CommandType

The command type.

command string

The command text, or the stored procedure name when type is StoredProcedure.

params IEnumerable<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

transaction or command is null.

ArgumentException

command is empty or white space.