Table of Contents

Constructor ExpressiveDbCommand

Namespace
Open.Database.Extensions
Assembly
Open.Database.Extensions.Core.dll

ExpressiveDbCommand(IDbConnectionPool<DbConnection>, CommandType, string, IEnumerable<Param>?)

Constructs a command that takes its connections from a connection pool.

public ExpressiveDbCommand(IDbConnectionPool<DbConnection> connectionPool, CommandType type, string command, IEnumerable<ExpressiveCommandBase<DbConnection, DbCommand, DbDataReader, DbType, ExpressiveDbCommand>.Param>? @params = null)

Parameters

connectionPool IDbConnectionPool<DbConnection>

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<DbConnection, DbCommand, DbDataReader, DbType, ExpressiveDbCommand>.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.

ExpressiveDbCommand(IDbConnectionFactory<DbConnection>, CommandType, string, IEnumerable<Param>?)

Constructs a command that creates a new connection from a connection factory for each execution.

public ExpressiveDbCommand(IDbConnectionFactory<DbConnection> connFactory, CommandType type, string command, IEnumerable<ExpressiveCommandBase<DbConnection, DbCommand, DbDataReader, DbType, ExpressiveDbCommand>.Param>? @params = null)

Parameters

connFactory IDbConnectionFactory<DbConnection>

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<DbConnection, DbCommand, DbDataReader, DbType, ExpressiveDbCommand>.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.

ExpressiveDbCommand(Func<DbConnection>, CommandType, string, IEnumerable<Param>?)

Constructs a command that invokes a function to create a new connection for each execution.

public ExpressiveDbCommand(Func<DbConnection> connFactory, CommandType type, string command, IEnumerable<ExpressiveCommandBase<DbConnection, DbCommand, DbDataReader, DbType, ExpressiveDbCommand>.Param>? @params = null)

Parameters

connFactory Func<DbConnection>

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<DbConnection, DbCommand, DbDataReader, DbType, ExpressiveDbCommand>.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.

ExpressiveDbCommand(DbConnection, IDbTransaction?, CommandType, string, IEnumerable<Param>?)

Constructs a command that executes on an existing connection, optionally within a transaction.

public ExpressiveDbCommand(DbConnection connection, IDbTransaction? transaction, CommandType type, string command, IEnumerable<ExpressiveCommandBase<DbConnection, DbCommand, DbDataReader, DbType, ExpressiveDbCommand>.Param>? @params = null)

Parameters

connection DbConnection

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<DbConnection, DbCommand, DbDataReader, DbType, ExpressiveDbCommand>.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.

ExpressiveDbCommand(DbConnection, CommandType, string, IEnumerable<Param>?)

Constructs a command that executes on an existing connection.

public ExpressiveDbCommand(DbConnection connection, CommandType type, string command, IEnumerable<ExpressiveCommandBase<DbConnection, DbCommand, DbDataReader, DbType, ExpressiveDbCommand>.Param>? @params = null)

Parameters

connection DbConnection

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<DbConnection, DbCommand, DbDataReader, DbType, ExpressiveDbCommand>.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.

ExpressiveDbCommand(IDbTransaction, CommandType, string, IEnumerable<Param>?)

Constructs a command that executes within a transaction, on the transaction's connection.

public ExpressiveDbCommand(IDbTransaction transaction, CommandType type, string command, IEnumerable<ExpressiveCommandBase<DbConnection, DbCommand, DbDataReader, DbType, ExpressiveDbCommand>.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<DbConnection, DbCommand, DbDataReader, DbType, ExpressiveDbCommand>.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.