Reputation: 1456
I am working MVC project
. I am having access of view page only in one project which I load using view engine
.
Now I want to use object caching
on view page
as I do not want to call service method every time.
Is there any way to do this? Any help is appreciated. Thanks.
Upvotes: 1
Views: 43
Reputation: 1554
You can cache your View like this :
[OutputCache(Duration = 10)]
public ActionResult Details(int id)
{
ViewData.Model = _dataContext.Movies.SingleOrDefault(m => m.Id == id);
return View();
}
Upvotes: 0