Describe the enhancement
Currently, RepoDB is not supporting the output parameters and/or there is no other way to extract the values.
Let us say, you had created the Stored Procedure below.
CREATE PROCEDURE sp_Multiply
(
@Input1 INT,
@Input2 INT,
@Output INT OUT
)
AS
BEGIN
SET @Output = (@Input * @Input2);
END
There is no way for us to get the value of the @Output parameter, unless we do it via native ADO.Net.
The current alternative is to return the output value as SCALAR and use the ExecuteScalar method instead. But that requires a small modification on the SP.
var output = connection.ExecuteScalar<decimal>("EXEC sp_Multiply;", new { Input1 = 100, Input2 = 200 });
Proposal
The QueryField object must support the ParamDirection enumeration so the Output value can be utilized. The value of the output parameters must be set back to the Parameter.Value of this object.
var outputQueryField = new QueryField("Output", ParamDirection.Output);
var params = new QueryField[]
{
new QueryField("Input1", 100),
new QueryField("Input2", 200),
outputQueryField
};
var output = connection.ExecuteScalar<decimal>("EXEC sp_Multiply;", params);
/* Get the value from the `outputQueryField.Parameter.Value` */
Or, an object OutputQueryField must be introduced that wraps the proper value of the ParameterDirection of the QueryField object.
var outputQueryField = new OutputQueryField("Output");
var params = new QueryField[]
{
new QueryField("Input1", 100),
new QueryField("Input2", 200),
outputQueryField
};
var output = connection.ExecuteScalar<decimal>("EXEC sp_Multiply;", params);
/* Get the value from the `outputQueryField.Parameter.Value` */
Additional Information
This is up and open for discussion with the .NET community.
Describe the enhancement
Currently, RepoDB is not supporting the output parameters and/or there is no other way to extract the values.
Let us say, you had created the Stored Procedure below.
There is no way for us to get the value of the
@Outputparameter, unless we do it via native ADO.Net.The current alternative is to return the output value as SCALAR and use the
ExecuteScalarmethod instead. But that requires a small modification on the SP.Proposal
The
QueryFieldobject must support theParamDirectionenumeration so theOutputvalue can be utilized. The value of the output parameters must be set back to theParameter.Valueof this object.Or, an object
OutputQueryFieldmust be introduced that wraps the proper value of theParameterDirectionof the QueryField object.Additional Information
This is up and open for discussion with the .NET community.