Archive

Posts Tagged ‘t4’

TCCC 7

October 24th, 2009

This past Saturday (October 24, 2009) I had the privilege of speaking at Twin Cities Code Camp 7. I spoke on T4 and how developers can use this awesome, little known tool that ships with Visual Studio 2008/2010 to start generating code and making their development lives easier. I walked through the basic composition of a T4 template, then showed some real world examples (i.e. T-SQL, Entity Framework, Linq 2 SQL, ASP.NET MVC, design patterns) of how T4 is currently being used today.

You can download the slide deck and demo code here.

In order to run the code you’ll need the following installed:

After installing the AdventureWorks database, you’ll need to run the SimpleEmployee.sql script included in the archive. This will create the SimpleEmployee table and populate it with data.

If you weren’t able to attend my session, or would like to get into even more in-depth with T4 you can check out the podcast I did with Jeff Brand along with a series of screencasts I did on the topic here.

adam Community, presentations, t4, tccc7 , , ,

T4 on Spaghetti Code

October 20th, 2009

My third Spaghetti Code podcast with Jeff Brand is up and available for your listening pleasure. In this episode Jeff and I discuss the Text Template Transformation Toolkit (T4). We talk about the toolkit’s origins, how to get started using it, and how you can use it to write less code! You can get the episode via Jeff’s page here.

If you like the podcast and are interested in learning even more about T4, be sure to swing on by Twin Cities Code Camp VII, this Saturday where I’ll be diving into this awesome, unheralded feature of Visual Studio. You can find out more info about code camp and register here.

adam Community, design patterns, t4 , ,

T4 Walkthrough Part 4 - Robustness

September 18th, 2009

In the third video in this series I showed you how to make your T4 code reusable. In this video I’ll show you how to make it robust. We’ll look at how to debug, handle exceptions, and even unit test, yes unit test, our templates.

Install Microsoft Silverlight

You can download the code here.

To run the code you’ll need the AdventureWorks databse, which you can download from CodePlex here.

You’ll also need the T4 Toolbox, which you can download from CodePlex here.

adam t4, video ,

T4 Walkthrough Part 3 - Reusability

September 18th, 2009

In the second video in this series I showed you how to use T4 to generate sql scripts for delete stored procedures. In this video I’ll show you how to take those templates and make them reusable, so that you can leverage them on multiple projects.

Install Microsoft Silverlight

{Once again, my apologies for the audio quality. I’m still working on acquiring a better mic.}

You can download the code here.

To run the code you’ll need the AdventureWorks databse, which you can download from CodePlex here.

You’ll also need the T4 Toolbox, which you can download from CodePlex here.

adam t4, video ,

T4 Walkthrough Part 2 - Let’s Start Generating

September 2nd, 2009

In the first video in this series I went over the basics of generating code with the T4. I discussed the tooling, various directives and components of a template, and how you can use T4 in a continuous integration process. In this video I’ll show you how to use T4 to generate sql scripts for delete stored procedures. Along the way we’ll review some of the concepts covered in the first post.

Install Microsoft Silverlight

{My apologies for the audio quality, I’m working on acquiring a better mic for future videos.}

You can download the code here.

To run the code you’ll need the AdventureWorks database, which you can download from  CodePlex here.

adam t4, video ,

T4 Walkthrough Part 1 - The Basics

September 2nd, 2009

Recently at a client I was in the midst of a major refactor. The previous developer had left nothing but a heaping pile of  spaghetti code. I wanted to refactor the mess to more of a patterns based approach, but I was hesitant to due to sheer amount of mundane work involved. You know what I’m talking about. How many data access layers, repositories, etc. have you coded up by hand, but are essentially identical. I knew there had to be a better way. A coworker of mine tripped a switch in my brain when he mentioned T4. I knew of T4 from listening to Scott Hanselman’s great inteview with Kathleen Dollard. However, I had never really seen where I could leverage it before. Until now! After spending a day getting familiar with T4, I was able to implement a repository pattern with unit tests via T4. This allowed me to focus on the business problems at hand rather than the stuff we do almost by rote memory.

I became so impressed with T4 that I thought I do several videos on the technology to make others aware of it and help them get up and running quickly. In this first video, I go over the various aspects of T4 including the tooling, various directives and components of a template, and how you can use T4 in a continuous integration process.

Install Microsoft Silverlight

{My apologies for the audio quality, I’m working on acquiring a better mic for future videos.}

You can download the code here.

adam t4, video ,