标签: c# asp.net-mvc attributes authorization
如何检索以下模式的权限列表?
[MyPermission(/*Get From DataBase*/)] public ActionResult MyController() { /**/ return View(); }
答案 0 :(得分:0)
你不能这样做。 属性参数在编译时被解析,并且只能是static和const值。您可以在自定义属性中包含调用数据库的代码,但不能将运行时值作为属性参数传递。