I am trying to return a scalar value from a stored procedure. I actually want to return the ID of a newly created record, but I have simplified my problem down to a stored p
to solve this entity framework issue and assuming you already have a stored procedure working and you don't want to fix the places where it works good using other ways then EF you can replace the:
RETURN(0)
with:
BEGIN
SELECT(0)
RETURN(0)
END
that is if its a part of an IF sentence,
theמ go to:
EF model (.edmx) -> Model Browser -> Function Imports -> (doubl click your func) ->Scalars -> Int32
now your return value is:
ObjectResult>
you can receive it by writing:
int? response = 0;
response = myEntity.myStoredProcedure(var1, var2).FirstOrDefault();
or in pics:
1.
2.
3.
doing all this makes the EF model (.edmx) also supporting the 'Update Model from Database...' and you can update it without worry to changes you just made.