What's the right way to run a EF6 stored procedure with output direction parameter?
List<MySqlParameter> parms = new()
{
new MySqlParameter { ParameterName = "@FilterJson", Value = JsonConvert.SerializeObject(input) },
new MySqlParameter { ParameterName = "@OutputJson", Direction = System.Data.ParameterDirection.Output }
};
var response = ReportingDetail.FromSqlRaw(
@"CALL p_detail_get(@FilterJson, @OutputJson)",
parms.ToArray()
);
This code throws an error:
MySqlConnector.MySqlException: 'Only ParameterDirection.Input is supported when CommandType is Text (parameter name: @OutputJson)'
Expected output is JSON, something like:
{"rows_count": 7, "actual_page": 1, "pages_count": 1}
The problem is not with a connection, other procedures with no output direction works fine. Defining a type of @OutputJson does not fix the issue - MySqlDbType = MySqlDbType.JSON
or DbType = System.Data.DbType.Object
.
Thank you for any help
According to the MySqlConnector disscussion, it is not possible to return output direction parameters through it. You can try to write ADO.NET code to omit this restriction.