开发者

how do I get ActionDescriptor from either ActionExecutingContext or AuthorizationContext?

开发者 https://www.devze.com 2022-12-14 18:51 出处:网络
I\'m writing a method that just uses the ActionDescriptor property but I can\'t figure out how to avoid repeating the body of the method so that it can take either an ActionExecutingContext or an Auth

I'm writing a method that just uses the ActionDescriptor property but I can't figure out how to avoid repeating the body of the method so that it can take either an ActionExecutingContext or an AuthorizationContext. Both of these types have an ActionDescriptor property, but they don't inherit it from a common type or interfac开发者_StackOverflowe that I can find.


Refactor the code that consumes the ActionDescriptor into its own static method somewhere, then call that method from within your OnActionExecuting() or OnAuthorization(), passing in the ActionDescriptor object.

0

精彩评论

暂无评论...
验证码 换一张
取 消