How to use the Resharper "go to controller" function

Resharper 6 has a very nice new feature: if I write RedirectToAction or Html.Action anywhere in the MVC3 project, it will be underlined and with ctrl-click I can move there. He also notifies me if such an action does not exist.
However , I have a helper method in my BaseController that takes an additional parameter (to be placed in TempData) and then calls RedirectToAction. Unfortunately, Resharper does not validate these lines as controller and method names and does not underline.

I use the same parameter naming convention as MVC, my return type is the same, but not anyway. Is it possible that MVC methods are hard-coded in Resharper? Is there a way to make it work on my method too?

Image included for clarity

+6
source share
1 answer

Yes, you can do this using ReSharper's code annotation attributes.

First go to ReSharper-> Options-> Code Annotations, copy the attributes to the clipboard and add them to your project.

Then mark the parameters of your methods with the necessary attributes. For example, mark the parameter containing the action string with AspMvcActionAttribute ; controller - using AspMvcControllerAttribute , etc.

+11
source

Source: https://habr.com/ru/post/901910/


All Articles