Table of Contents

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

connectionPool IDbConnectionPool

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 stored procedure name.

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

connectionPool or command is null.

ArgumentException

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

connFactory IDbConnectionFactory

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

connFactory or command is null.

ArgumentException

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

connFactory Func<IDbConnection>

The function that creates the connections. Each execution invokes it, opens the connection 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<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

connFactory or command is null.

ArgumentException

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

connection IDbConnection

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

connection or command is null.

ArgumentException

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

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

transaction or command is null.

ArgumentException

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

connection IDbConnection

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

connection or command is null.

ArgumentException

command is empty or white space.