Skip to main content


Showing posts from June, 2010

Modifying Code Generation Templates for MvcContrib Grid

Visual Studio 2010 in general, and MVC 2 in particular, bring the concept of code generation templates into the realm of first-class objects. Well, maybe it's not that good. However, MVC definitely makes tremendous use of the code generation template system, called Text Transformation Template Toolkit (or T4 for short). A fantastic introduction to T4 editing can be found in the January 2010 issue of MSDN Magazine, titled "Text Template Transformation Toolkit and ASP.NET MVC." That article covers the basics of editing T4 templates, so I won't bother repeating the same information. Instead, I'll describe the template I created for our team's latest project.

Before I get to the template itself, I need to describe the tools we're using, how to install them, and a little background on why we decided to do what we're doing.

The toolsMvcContrib GridEarly on, we did what most teams do. We used the tools provided. For creating a list of strongly-typed objects (…