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
connectionSqlConnectionThe connection to execute on. It is opened only if it is closed, closed again afterwards if the command opened it, and never disposed.
procedureNamestringThe stored procedure name.
Returns
- ExpressiveSqlCommand
A new ExpressiveSqlCommand with StoredProcedure to configure with parameters and then execute.
Exceptions
- ArgumentNullException
connectionorprocedureNameis null.- ArgumentException
procedureNameis 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
transactionSqlTransactionThe transaction to execute in. The command runs on the transaction's Connection.
procedureNamestringThe stored procedure name.
Returns
- ExpressiveSqlCommand
A new ExpressiveSqlCommand with StoredProcedure to configure with parameters and then execute.
Exceptions
- ArgumentNullException
transactionorprocedureNameis null.- ArgumentException
procedureNameis 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
connectionSourceIDbConnectionFactory<SqlConnection>The factory that creates the connections. Each execution creates a connection, opens it if needed, and disposes it when finished.
procedureNamestringThe stored procedure name.
Returns
- ExpressiveSqlCommand
A new ExpressiveSqlCommand with StoredProcedure to configure with parameters and then execute.
Exceptions
- ArgumentNullException
connectionSourceorprocedureNameis null.- ArgumentException
procedureNameis 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
connectionSourceIDbConnectionPool<SqlConnection>The pool to take connections from. Each execution takes one, opens it if needed, and gives it back when finished.
procedureNamestringThe stored procedure name.
Returns
- ExpressiveSqlCommand
A new ExpressiveSqlCommand with StoredProcedure to configure with parameters and then execute.
Exceptions
- ArgumentNullException
connectionSourceorprocedureNameis null.- ArgumentException
procedureNameis 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
connectionSourceFunc<SqlConnection>The function that creates the connections. Each execution invokes it, opens the connection if needed, and disposes it when finished.
procedureNamestringThe stored procedure name.
Returns
- ExpressiveSqlCommand
A new ExpressiveSqlCommand with StoredProcedure to configure with parameters and then execute.
Exceptions
- ArgumentNullException
connectionSourceorprocedureNameis null.- ArgumentException
procedureNameis empty or white space.