Dapper icon indicating copy to clipboard operation
Dapper copied to clipboard

Can't get value of output parameters if the stored procedure doesn't perform any SELECT statement

Open nhathongly opened this issue 7 years ago • 0 comments

In my stored procedure, if some input parameters do not meet some conditions, it will set error codes to an output parameter instead of performing a SELECT to return a result set. And when it happens, I can't get value of the output parameter from the DynamicParameters.

In the source code of SqlMapper.cs, I found this at line 1090

if (reader.FieldCount == 0) //https://code.google.com/p/dapper-dot-net/issues/detail?id=57
     yield break;

Because the FieldCount is 0 in this case, command.OnCompleted() is never called, so that outputs are not set back to DynamicParameters.

nhathongly avatar Apr 23 '19 06:04 nhathongly