protected static T redirectTo<T, CONTROLLER>(Expression<Func<CONTROLLER, object>> expression) where T : ViewModel, new()
{
return new T() {Override = new ControllerRedirectResult<CONTROLLER>(expression)};
}
Just a wee bit of code we're using in our MVC Controller base class. I'm happy with what it *does,* but tell me that isn't butt ugly code. I think the angle bracket and generic constraint noise tax is like the governor on school buses that keeps them from going over 65 miles an hour. Anders' way of telling you that you're going too far and time to back off. Anyway, the usage of the stuff above isn't that bad, and the unit testing is pretty easy.
Comments are welcome. This kind of thing bothers me in the sense that later developers are gonna scream WTF! when they find it in the code.