tangible T4 Directives

 

The tangible T4 Editor extends the set of existing T4 Directives that can be used inside T4 Text Template files. This list gives an overview on additional directives that can be used when working with the tangible T4 Editor.

 

The documentation of the basic T4 Text Template Directives is availabl in this MSDN Article.

 

Directive: TangibleClassDiagram

 

Purpose

Allows access to a tangible Class Diagram (.tacl) object model from within a T4 template.

 

Syntax

<#@ TangibleClassDiagram processor="TangibleClassDiagramDirectiveProcessor" provides="ModelRoot" requires="fileName='{relativepath}'" #>

 

Sample

After adding this directive you gain access to the object model of the Class Diagram via the ModelRoot property.

 


<#@ template inherits="Microsoft.VisualStudio.TextTemplating.VSHost.ModelingTextTransformation" debug="true" hostSpecific="true" #>

<#@ TangibleClassDiagram processor="TangibleClassDiagramDirectiveProcessor"

                         provides="ModelRoot"

                         requires="fileName='.\ClassDiagrams1.tacls'" #>

<#
    // render the names of all types in the model
    foreach(var type in this.ModelRoot.Types)
    {
#><#= type.Name #>
<#  } 
#>