Having written way too many code generators in my life, I’ve always been attracted to Microsoft’s T4 generation. For those who don’t know what T4 is, it’s actually a core technology in Visual Studio (all versions) that has been around for a very long time. It’s used for lots of things including for example generating the C# code that is compiled into your projects with Entity Framework.
Over the past 5 years, I’ve tried on several occasions to build my own T4 templates and unfortunately have always given up because the building of T4 templates experience in Visual Studio is just not pleasant.
Because of the huge success of Visual Studio in the market place, there are lots of third party tools available. The one I’m writing about here is from Tangible and is basically an add on to Visual Studio that let’s you work on T4 Templates in a very friendly manner. It gives you full intellisense around create classes, and most importantly gives you an awesome development experience. For example, as shown in the demo video (screen shot below) you can actually step through running the T4 video and watch your code get generated one line a time. You of course also watch variables change and everything else you would expect in a Visual Studio debugging session. That alone is worth the cost of admission!
There are of course lots of other things the commercial add on to Visual Studio does, but for me, it’s really the T4 editor piece that make it worth the money.