icsharpcode / NRefactory

NRefactory - Refactoring Your C# Code
684 stars 261 forks source link

How to get controllers and actions attributes without using reflection #522

Open weedkiller opened 7 years ago

weedkiller commented 7 years ago

hello, how can I get all controller/action filters and attributes without using reflection.

for e.g. I want to parse and get similar results from NRefactory

public void OnActionExecuting(ActionExecutingContext c) 
     // how can I do something similar in Nrefactory
     {
       var controllerActionDes = c.ActionDescriptor as ControllerActionDescriptor;
       if (controllerActionDescriptor != null)
        {
        var actionAttributes = controllerActionDes .MethodInfo...
        }
     }