1

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.

Vinoth Krishnan
  • 2,925
  • 6
  • 29
  • 34
Ankita
  • 1,416
  • 4
  • 17
  • 42

1 Answers1

0

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();
        }
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Dilip Oganiya
  • 1,504
  • 12
  • 20
  • Thanks for your comment but I already mentioned that I do not have access of Controll or action method. I use view page only using partial view engine. Moreover, I call service method from my View using EngineContext. I want to put that part only in caching. – Ankita Apr 19 '16 at 06:40