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
Properties
ParameterDeriver
How a provider's procedure metadata is copied onto a command. The default locates the provider's
DeriveParameters method by convention. Set this when a provider uses a different entry point.
public static Action<IDbCommand> ParameterDeriver { get; set; }
Property 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 used to inspect the procedure. It is opened temporarily when needed.
procedureNamestringThe procedure to call.
inputOutputHasDefaultboolWhether provider-derived input/output parameters may be omitted.
Returns
FromAsync(DbConnection, string, bool, CancellationToken)
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, bool inputOutputHasDefault = true, CancellationToken ct = default)
Parameters
connectionDbConnectionThe connection used to inspect the procedure. It is opened temporarily when needed.
procedureNamestringThe procedure to call.
inputOutputHasDefaultboolWhether provider-derived input/output parameters may be omitted.
ctCancellationTokenThe forwarded cancellation token.
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.