-1

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?

Kirschstein
  • 14,570
  • 14
  • 61
  • 79

5 Answers5

4

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.

Haacked
  • 58,045
  • 14
  • 90
  • 114
3

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.

Adrian Grigore
  • 33,034
  • 36
  • 130
  • 210
3

The risks of using features from ASP.NET MVC Futures are

  • they are considered not polished enough to ship as part of the core framework, so could introduce some bugs;
  • the Microsoft team may not merge them all into the next version of the core ASP.NET MVC package or significantly change their behaviour.
Alexander Prokofyev
  • 33,874
  • 33
  • 95
  • 118
2

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.

Chad Moran
  • 12,834
  • 2
  • 50
  • 72
1

Not so sure about the futures, but I would highly recommend the Mvccontrib library which depends on some bits in the futures.

Wyatt Barnett
  • 15,573
  • 3
  • 34
  • 53