Using magic strings in C# really unsettles me, so I'm thinking of using the MVC Futures library.
Are there any reasons why I might not want to do this, or any gotchas I should be aware of?
Using magic strings in C# really unsettles me, so I'm thinking of using the MVC Futures library.
Are there any reasons why I might not want to do this, or any gotchas I should be aware of?
I've been using it for about 1 month now and really like it. For instance, I love the new strongly typed Html helpers, it sure beats using magic strings:
<%= Html.TextBoxFor(m => m.User.FirstName)%>
According to the MVC roadmap, this feature will be part of MVC 2, but even if it shouldn't, I still have the futures source code so I can use this helper implementation as a last resort.
The risks of using features from ASP.NET MVC Futures are
I think it has some features that really should be in the MVC library but I would stay away from the strongly-typed action links. That can get extremely expensive on the CPU potentiall9y adding SECONDS (not MS) to your page render time.
http://www.chadmoran.com/blog/2009/4/23/optimizing-url-generation-in-aspnet-mvc-part-2.html
One of the functions available in MVC futures I often find myself using is RenderAction since it is the only way to worka around partial output caching.
Not so sure about the futures, but I would highly recommend the Mvccontrib library which depends on some bits in the futures.
First of all, just because it's a string, doesn't make it a "magic" string. Second of all, I would recommend looking at the T4MVC templates David Ebbo writes about here: http://blogs.msdn.com/davidebb/archive/2009/06/17/a-new-and-improved-asp-net-mvc-t4-template.aspx.
The benefit of this approach is by using code generation, you get strong typing everywhere and it doesn't require compiling expressions which can hurt performance.