I found several articles like this: http://devtoolshed.com/using-stored-procedures-entity-framework-scalar-return-values
However, when I take the step to create an import function for the int32 scanner, this is what is generated:
public ObjectResult<Nullable<global::System.Int32>> MyStoredProcedure(Nullable<global::System.Int32> orderId) { ObjectParameter orderIdParameter; if (orderId.HasValue) { orderIdParameter = new ObjectParameter("OrderId", orderId); } else { orderIdParameter = new ObjectParameter("OrderId", typeof(global::System.Int32)); } return base.ExecuteFunction<Nullable<global::System.Int32>>("MyStoredProcedure", orderIdParameter); }
I can call the procedure with this, but I can not get to the main scalar:
ObjectResult<int?> result = myEntities.MyProcedure(orderId);
In the code examples that I saw, I should get context.MyProcedure().SingleOrDefault() .
Roger source share