1

我在工作MVC project。我只能在我使用加载的一个项目中访问视图页面view engine

现在我想使用object cachingonview page因为我不想每次都调用服务方法。

有没有办法做到这一点?任何帮助表示赞赏。谢谢。

4

1 回答 1

0

您可以像这样缓存您的视图:

[OutputCache(Duration = 10)]
public ActionResult Details(int id)
        {
            ViewData.Model = _dataContext.Movies.SingleOrDefault(m => m.Id == id);
            return View();
        }
于 2016-04-19T06:38:00.273 回答