Is it possible to wire up a stored proc that may or may not return a result, but does return a return code? E.g. a trivial example is proc that does an update, and returns a result shape with a single ID column, but also returns a return code. In the scenario where the proc fails I don't want to to return a result shape, just the return code.
For example, the dynamically generated .cs file for the .rlinq model defines the query like this:
IEnumerable<UpdateSomethingResult> queryResult = this.ExecuteQuery<UpdateSomething>("[dbo].[UpdateSomething]", CommandType.StoredProcedure, parameterName, parameterDescription, parameterReturnValue);
returnValue = parameterReturnValue.Value == DBNull.Value ? -1: (int)parameterReturnValue.Value;
At the moment if I don't return a result shape I get the dreaded "Object reference not set to instance of object" error, because Data Access is expecting a result but nothing is being return from the proc call. Is there a way to make the result "optional"?