How to retrieve output parameter from stored procedure by EF code first
To retrieve the data for a stored procedure call, you can use the following
using(var db = new YourConext())
{
var details = db.Database.SqlQuery<YourType>("exec YourProc @p",
new SqlParameter("@p", YourValue));
}
YourType: might be int or string or long or even a ComplexType
@p: in case if the stored procedure has parameters and you can define as many as you need from parameters
if you need more information about SqlQuery , you might check the following
- Writing SQL queries for entities
- Entity Framework Code First and Stored Procedures
Hope this will help you