Table of Contents

Method GetProcedureParameterNames

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

GetProcedureParameterNames(SqlConnection, string)

Gets the parameter names a stored procedure declares by reading sys.all_parameters, so parameters added with AddParam(value) find their real names.

protected override ImmutableArray<string> GetProcedureParameterNames(SqlConnection connection, string procedure)

Parameters

connection SqlConnection

An open connection to run the lookup on. A command that executes inside a transaction must use Transaction.

procedure string

The procedure name as given to the command.

Returns

ImmutableArray<string>

The names as the provider reports them (a leading @ is fine), or an empty or default array when they are not known.

Remarks

The procedure is looked up in the connection's current database; a name that does not resolve there (a missing procedure, no permission to see it) gives no names, and a name with a database part (otherdb.dbo.proc) is not looked up at all, because the lookup runs in the current database: in both cases the last member of each argument is used as written.

The lookup runs with the command's timeout (SetTimeout).

A failure of the lookup is thrown as it is (a SqlException stays a SqlException, so a retry policy still sees it), with the procedure's name added to Data under the key Procedure.