My .NET SIG Presentation on T4 Templates

In February, I co-presented at the Cleveland .NET Special Interest Group (SIG) on T4 Templates. Mel Leeb and I walked through this hidden gem that is part of VS 2008. You can find the slides and our sample code on the Bennett Adelson web site.

If you haven’t seen T4 before, it is worth a look. T4 is built in to VS 2008 and can be added to VS 2005. It provides a code generation option that is very powerful and nicely integrated into the VS IDE.

I highly recommend Oleg Sych’s blog for great info on T4 and a nice toolkit. I also highly recommend the T4 Editor by Clarius. They have a free version and a full version. They provide syntax coloring and intellisense that make T4 editing much better than the default plain text experience.

The sample code includes a “real world” example based on some work I did in a recent project. This sample shows how to use T4 templates to generate a data access layer using SQL table metadata. The templates demonstrate one way to make the templates configurable so that you can accommodate the different data types or names in the database vs the entities.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: