c# - How find references for MVC controller methods in Visual Studio -


coming long period of webforms development, began working mvc. 1 thing struck me, since controller methods not called directly code, visual studio won't pick references them.

silly example code image

i understand reason why there no reference count, can problematic sometimes. let's rewrite controller method accomodate new requirement, perhaps call method needs additional data or modified result. perhaps method, or endpoint if will, being called several places, , change made breaks result handling other calls. able find code in solution, going invoke endpoint.

currently tend copy method name , perform regular text search in entire solution, works rather long method name isn't generic. if method name "index", can long day.

are there recommendations on how simplify this, such coding conventions, plugins or otherwise? i.e. how can locate endpoint invoked?

i use visual studio 2017 enterprise, solutions working in other versions preferred - make answer useful many possible. in advance / culme

update: learned lot based on comments , replies got. apart mentioned below, decided try , keep controller method names unique , identifiable, simplify finding being used. example, instead of "index", i'll try use "fidgets_indexcontroller" or similar. way, simple text search go long way locating calling code.

one of options resharper - more or less can determine use html.actionlink() or html.beginform() points controller action. won't detect posts/redirects done js.

also thing can use t4mvc make links views statically typed, can search on references.

text search through solution can help, not discovered - how many references string index have in average mvc project? distinctive controller/action names, not common names.

apart on own. if try doing clever, in js concatenate strings give right endpoint - in trouble.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -