This article was very helpful.
https://damianbrady.com.au/2014/12/19/calling-stored-procedures-from-entity-framework-6-code-first/
So basically, we call the stored procedure from DbContext class like so:
https://damianbrady.com.au/2014/12/19/calling-stored-procedures-from-entity-framework-6-code-first/
So basically, we call the stored procedure from DbContext class like so:
public virtual Customer_LoadStatus_Result Customer_LoadStatus(int? customerId)
{
var customerIdParameter = customerId.HasValue ?
new SqlParameter("CustomerId", customerId) :
new SqlParameter("CustomerId", typeof(int));
return this.Database.SqlQuery<Customer_LoadStatus_Result>("Customer_LoadStatus @customerId",
customerIdParameter).SingleOrDefault();
}
No comments:
Post a Comment