If your using MVC then please at least take a look at T4MVC or better still add it to your project from Nuget here T4MVC from Nuget – It’s written by David Ebbo who works for Microsoft and works on Nuget as well as a lot of other cool stuff.

What is T4MVC? – the following is lifted from the documentation:-

“T4MVC is a T4 template for ASP.NET MVC apps that creates strongly typed helpers that eliminate the use of literal strings when referring the controllers, actions and views. It helps make your MVC code much more maintainable, and gives you intellisense where you normally would not have any.”

Some links for more info:-

  • David’s Blog posts on T4MVC can be found here:- Posts
  • T4MVC Introduction Video here.

An example again lifted from the site would be:-

@Html.RenderPartial("DinnerForm");

Now becomes

@Html.RenderPartial(MVC.Dinners.Views.DinnerForm); 

and you get Intellisense for free which is nice.

Also this

@Html.ActionLink("Delete Dinner", "Delete", "Dinners", new { id = Model.DinnerID }, null)

becomes this

@Html.ActionLink("Delete Dinner", MVC.Dinners.Delete(Model.DinnerID))

The beauty of this needs to be tried to ge the full extent of whats available but its really easy to add in and change your links in a flash.

By the way it even works for images so heres an example using the aspx syntax.

<img src="/Content/nerd.jpg" />

becomes

<img src="<%= Links.Content.nerd_jpg %>" />

T4MVC is very handy indeed and you should definitely check this out.