The goal
I want to call Stored Procedures on my controller with C# + MVC 4 + Entity Framework 5.
The problem
I found this topic that talk about "How to use DbContext.Database.SqlQuery(sql, params) with stored procedure? EF Code First CTP5" and that is exactly what I'm need.
In the topic we have the following code:
context.Database.SqlQuery<myEntityType>(
"mySpName @param1, @param2, @param3",
new SqlParameter("param1", param1),
new SqlParameter("param2", param2),
new SqlParameter("param3", param3)
);
As you can see, there is a generic type (?) called myEntityType
and I do not know who is my entity type.
I'm using Entity Framework 5 and all of my CRUD was generated by him.
Details
What I want it is simple (I guess): display the return of procedure in my view. The above's code is what I have on ProductsController:
//
// GET: /Products/
public ActionResult Index()
{
return View(db.bm_products.ToList());
}
I want to display the return in this method.
What I have
Maybe myEntityType
is bm_products
?
Thanks in advance.