【发布时间】:2013-04-19 02:16:02
【问题描述】:
看看下面的代码。
当Get() 调用Foobar() 和Foobaz() 时,不会调用装饰Foobar() 和Foobaz() 的ActionFilters。
如何在Get() 中调用这两个控制器操作,同时导致SomeAction 和AnotherAction 过滤器执行?
public class Features : Controller
{
[SomeAction]
public bool Foobar(string id = null)
{
return true;
}
[AnotherAction]
public bool Foobaz()
{
return false;
}
public JsonResult Get()
{
return this.JsonResult(new Dictionary<string, bool>()
{
{ "foobar", this.Foobar() },
{ "foobaz", this.Foobaz() }
});
}
}
【问题讨论】:
标签: asp.net-mvc action-filter asp.net-mvc-controller