I have base controller which calls database table and get data through ado.net entity framework. When I call every controller base controller is called. When ever base controller is called it data from sql db and pulls my table information.
I read that entity framework caches data. so in this case will it hit db every time for each controller call or it hit once and cache the data?
public class BaseController : Controller
{
MyEntities db= new MyEntities();
protected override void OnActionExecuting(ActionExecutingContext filterContext)
{
var details = db.mytables.tolist();
}
}
All my controllers inherit base controller
public class MyController : BaseController
{
//my code
}