Saturday, June 4, 2011

Routes in ASP.NET MVC: The Rails Way

Some think that using routes in ASP.NET MVC, are a little to noisy and likes the Rails way better.

The Rails Way

home_url

The ASP.NET MVC way

@Html.RouteLink("Home", "Root")

A bright individual, Rob Conery, wanted to change this a wrote a blog post called, Referencing Routes in ASP.NET MVC The Rails Way. Basically it allows you to use routes in ASP.NET MVC this way

Routes in MVC the Rails way

@Routes.home_url
// And set route variables like this
@Routes.home_url(new { id = "stuff" });

No comments:

Post a Comment