Class StoredProcedure
Reads stored procedure parameter names, types, sizes, and directions from the database. Use FromProc(string, IDbConnection, bool) while creating a command.
public static class StoredProcedure
- Inheritance
-
StoredProcedure
- Inherited Members
Fields
ParameterDeriver
How a procedure's parameters are read onto a command. Every provider ships this as
DeriveParameters on its command builder, and the default finds that one by the name the
provider gave it, so this only needs setting for a provider that breaks the convention or to put
something else in its place.
public static Action<IDbCommand> ParameterDeriver
Field Value
Methods
DeriveThroughProvider(IDbCommand)
Reads a procedure through the command builder the provider ships beside its command, which is named
for it. A SqlCommand is read by SqlCommandBuilder and an NpgsqlCommand by
NpgsqlCommandBuilder. The one found for a command type is kept, so the search happens once.
public static void DeriveThroughProvider(IDbCommand command)
Parameters
commandIDbCommand
From(IDbConnection, string, bool)
The command for a procedure, reading what it declares through ParameterDeriver.
public static QueryCommand From(IDbConnection connection, string procedureName, bool inputOutputHasDefault = true)
Parameters
connectionIDbConnectionThe connection to ask, opened for the question if it is not already.
procedureNamestringThe procedure to call.
inputOutputHasDefaultboolWhether provider-derived input/output parameters may be omitted.
Returns
FromAsync(DbConnection, string, CancellationToken, bool)
The command for a procedure, reading what it declares through ParameterDeriver, opening the connection asynchronously when it is not already open.
public static Task<QueryCommand> FromAsync(DbConnection connection, string procedureName, CancellationToken ct = default, bool inputOutputHasDefault = true)
Parameters
connectionDbConnectionThe connection to ask, opened for the question if it is not already.
procedureNamestringThe procedure to call.
ctCancellationTokenThe forwarded cancellation token.
inputOutputHasDefaultboolWhether provider-derived input/output parameters may be omitted.
Returns
FromCommand(IDbCommand, bool)
The command for a procedure whose parameters are already on command, put there by
a deriver or by hand. They are taken as the procedure's declaration, for their names and for how each
one binds.
public static QueryCommand FromCommand(IDbCommand command, bool inputOutputHasDefault = true)
Parameters
commandIDbCommandA command naming the procedure, carrying its parameters.
inputOutputHasDefaultboolWhether provider-derived input/output parameters may be omitted.