Execution Priority in custom Attributes in asp.net mvc

心已入冬 提交于 2019-12-06 19:55:01

问题


I have two custom attributes in my asp.net mvc(C#) application.

[CustAttribute1()]
[CustAttribute2()]

When I use those attributes to my actions, which will get executed first?

[CustAttribute1()]
[CustAttribute2()]
public ActionResult Index()
{

Can I use more than one custom attributes for my actions? If so, in the above Action, which custom attribute will execute first?


回答1:


Set the Order property.

[CustAttribute1(Order=2)]
[CustAttribute2(Order=1)]
public ActionResult Index() {
    return View();
}


来源:https://stackoverflow.com/questions/1770550/execution-priority-in-custom-attributes-in-asp-net-mvc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!