2
In the Web Forms every time I’ve assembled some kind of CRUD, used the using
to make an implicit Dispose().
public List<Produtos> Lista ()
{
using (var ctx = new DbContext())
{
return ctx. Produtos.ToList();
}
}
In ASP.net MVC this is done in what way?
public ActionResult Lista ()
{
DbContext ctx = new DbContext ();
return View ( ctx. Produtos );
}
Take a look at this link and see if it helps you http://stackoverflow.com/questions/1380019/asp-mvc-when-is-icontroller-dispose-called
– Rafael Cabral