Site Archives T4
T4 Toolbox
You may have noticed that in my last couple of articles about T4, the download links point to a CodePlex project called T4 Toolbox. This post describes what this project is about.
Extending T4: <#@ xsd #> directive
This article describes a custom T4 directive processor for converting XML schema definitions into .NET classes, which allows using strongly-typed code to extract information from various XML files. In particular, this simplifies creating custom T4 code generation templates for LINQ to SQL .dbml files and ADO.NET Entity Framework .edmx files. The article includes links to ready to use xsd directive processor and sample source code.
T4: Extending the Generated Template Class by Mike Pagel
Mike Pagel recently posted an interesting article about T4 on CodeProject called “T4: Extending the Generated Template Class“. In this article, Mike describes several approaches for implementing code generation logic - helper methods defined in class feature blocks, custom directive processors and a custom TextTransformation base class referenced using the inherits attribute of the template […]
T4 template for generating SQL view from C# enumeration
Database tables often contain columns that store codes, or values with special meaning. In application code, these special values can be encapsulated as enumerations. This article demonstrates how to use T4 code generation templates and Visual Studio CodeModel API to generate SQL views that encapsulate the special values for use in SQL code.
Test runner for T4 unit tests
This post shows how to create unit tests that run during T4 template transformation. This approach allows creating automated tests for template code that relies on specific capabilities of a T4 host, such as access to Visual Studio extensibility APIs. The post includes a ready to use test runner for T4 unit tests.
T4 Architecture
This article provides an in-depth look at the architecture of T4 template transformation process, discusses some constraints that limit template design, describes techniques that can be used to work around these limitations and points out some (sometimes undocumented) mechanisms for making your T4 templates more powerful.
T4 Template for Generating ADO.NET Entity Framework Stored Procedures
David DeWinter posted a great article about using T4 to generate stored procedures for ADO.NET entity data models. It includes a ready to use T4 template that will generate stored procedures for every .EDMX file in a given directory.
T4 Template Design: Nested Template Class
Nested Template Class is one of T4 template design techniques that can be used to develop reusable templates. The main template is defined as a nested TextTransformation class inside of a class feature block.
Find It Quickly
Find what you're looking for quickly by using our keyword search. Can't find it? Try our links below.


