tags:

views:

30

answers:

1

In my ASP.NET MVC controller classes I have action methods.

In my views I have Html.ActionLinks that have the names of those action methods set as their actionName values.

A typo in either of these locations will break things. Are there any tools that can check my controllers and views for validity in this manner?

+2  A: 

In the mvc futures assembly there are overloads of ActionLink that take an expression e.g.:

<%=Html.ActionLink<ProductsController>(o => o.Create(), "New")%>

These can be checked at compile time and are 'refactoring friendly'.

You will need to follow a couple of extra steps to force Visual Studio to compile your views so you get an error when the names don't match up (details here)

Steve Willcock
Excellent - can you provide a link?
Richard Ev
updated the post with a link and notes on how to get the views to go through the compiler to provide compile time checking :)
Steve Willcock
Resharper will show you the errors too
Paco