Fro*_*rud 102 outputcache asp.net-mvc-2
在ASP.NET MVC2中我使用OutputCache和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?
}
Run Code Online (Sandbox Code Playgroud)
如何使用这两个参数来缓存页面?我输入两次添加属性吗?或者写"customerId,languageId"作为值?
Kev*_*che 194
您可以对所有参数使用*或使用分号分隔列表(VaryByParam = "customerId;languageId").
如果你不想让它缓存不同的版本,你也可以使用none.
| 归档时间: |
|
| 查看次数: |
46320 次 |
| 最近记录: |