85
在ASP.NET MVC2中,我使用OutputCache
和VaryByParam
屬性。我用一個參數就可以正常工作,但當我在該方法上有幾個參數時,正確的語法是什麼?如何在多個參數中使用VaryByParam?
[OutputCache(Duration=30, VaryByParam = "customerId"]
public ActionResult Index(int customerId)
{
//I've got this one under control, since it only has one parameter
}
[OutputCache(Duration=30, VaryByParam = "customerId"]
public ActionResult Index(int customerId, int languageId)
{
//What is the correct syntax for VaryByParam now that I have a second parameter?
}
如何使用兩個參數來緩存頁面?我輸入兩次添加屬性嗎?或者寫下「customerId,languageId」作爲值?
鏈接不起作用 – Espo 2011-09-13 08:36:22
更新了鏈接。 :-) – klabranche 2011-11-02 17:17:52