Table of Contents

Method StoredProcedure

Namespace
Open.Database.Extensions
Assembly
Open.Database.Extensions.MSSqlClient.dll

StoredProcedure(SqlConnection, string)

Creates an ExpressiveSqlCommand that calls a stored procedure on the given connection.

public static ExpressiveSqlCommand StoredProcedure(this SqlConnection connection, string procedureName)

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.

procedureName string

The stored procedure name.

Returns

ExpressiveSqlCommand

A new ExpressiveSqlCommand with StoredProcedure to configure with parameters and then execute.

Exceptions

ArgumentNullException

connection or procedureName is null.

ArgumentException

procedureName is empty or white space.

StoredProcedure(SqlTransaction, string)

Creates an ExpressiveSqlCommand that calls a stored procedure within the given transaction.

public static ExpressiveSqlCommand StoredProcedure(this SqlTransaction transaction, string procedureName)

Parameters

transaction SqlTransaction

The transaction to execute in. The command runs on the transaction's Connection.

procedureName string

The stored procedure name.

Returns

ExpressiveSqlCommand

A new ExpressiveSqlCommand with StoredProcedure to configure with parameters and then execute.

Exceptions

ArgumentNullException

transaction or procedureName is null.

ArgumentException

procedureName is empty or white space.

StoredProcedure(IDbConnectionFactory<SqlConnection>, string)

Creates an ExpressiveSqlCommand that calls a stored procedure, that creates a new connection from a connection factory for every execution.

public static ExpressiveSqlCommand StoredProcedure(this IDbConnectionFactory<SqlConnection> connectionSource, string procedureName)

Parameters

connectionSource IDbConnectionFactory<SqlConnection>

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

procedureName string

The stored procedure name.

Returns

ExpressiveSqlCommand

A new ExpressiveSqlCommand with StoredProcedure to configure with parameters and then execute.

Exceptions

ArgumentNullException

connectionSource or procedureName is null.

ArgumentException

procedureName is empty or white space.

StoredProcedure(IDbConnectionPool<SqlConnection>, string)

Creates an ExpressiveSqlCommand that calls a stored procedure, that takes its connections from a connection pool.

public static ExpressiveSqlCommand StoredProcedure(this IDbConnectionPool<SqlConnection> connectionSource, string procedureName)

Parameters

connectionSource IDbConnectionPool<SqlConnection>

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

procedureName string

The stored procedure name.

Returns

ExpressiveSqlCommand

A new ExpressiveSqlCommand with StoredProcedure to configure with parameters and then execute.

Exceptions

ArgumentNullException

connectionSource or procedureName is null.

ArgumentException

procedureName is empty or white space.

StoredProcedure(Func<SqlConnection>, string)

Creates an ExpressiveSqlCommand that calls a stored procedure, that invokes a function to create a new connection for every execution.

public static ExpressiveSqlCommand StoredProcedure(this Func<SqlConnection> connectionSource, string procedureName)

Parameters

connectionSource Func<SqlConnection>

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

procedureName string

The stored procedure name.

Returns

ExpressiveSqlCommand

A new ExpressiveSqlCommand with StoredProcedure to configure with parameters and then execute.

Exceptions

ArgumentNullException

connectionSource or procedureName is null.

ArgumentException

procedureName is empty or white space.