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: TangibleComponentDiagram

 

Purpose

Allows access to a tangible Component Diagram (.tacmpt) object model from within a T4 template.

 

Syntax

<#@ TangibleComponentDiagram processor="TangibleComponentDiagramDirectiveProcessor" provides="ComponentModel"

                             requires="fileName='{relativefile}'" #>

 

Sample

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

 


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

<#@ TangibleComponentDiagram processor="TangibleComponentDiagramDirectiveProcessor"

                             provides="ComponentModel"

                             requires="fileName='.\ComponentsDesigner1.tacmpt'" #>

<# 

    // render the names of all components in the diagram
    foreach(var component in this.ComponentModel.Components)
    {
#><#= component.Name #>
<#  }
#>