Annotations to recognize anonymous objects as route values?

I work with some third-party controls that use route values passed in as an anonymous object, e.g. new { Controller = "ControllerName", Action = "ActionName" }.

Is there any way to write a custom annotation (or something like that) so R# can recognize anonymous objects with a signature like that (i.e. having Controller and Action string properties) and treat those properties as though they have AspMvcControllerAttribute and AspMvcActionAttribute applied to them?

Granted, there's probably another way to get the desired result here, but it sure would be handy if I didn't have to rewrite all the places that use that pattern. Pattern search / replace could take care of it but getting the task of actually doing it to be approved is another story entirely.

0
2 comments

Hello!

 

Thank you for contacting us.

Seems that External annotations feature could help in your case, please refer for the following help article - https://www.jetbrains.com/help/resharper/Code_Analysis__External_Annotations.html

Thank you.

0
Avatar
Permanently deleted user

Thanks very much for your help. I'll read up on external annotations.

0

Please sign in to leave a comment.