Class Statement blocks

Top  Previous  Next

T4 Template Helper function


<#+ [method][field declaration][property declaration]; #>


The <#+ tag indicates a template helper block. The helper block allows the template developer to add code at the T4 TextTransformation Class level. The code added can be a Method, a Field, or a Property declaration.


A method that is declared within the helper block, it can be compared to a #GROUP from the Clarion Win32 template language. Embeds can also be declared inside a helper block.




field declaration


<#+ string adoRepositoriesDirectory; #>



method definition


<#+void GenerateUpdate(ITable t)


   string methodName = ("ADO" + t.Name + ".Update").PadRight(40) + "PROCEDURE(" + t.Name + " " + t.Name + "ToUpdate)";




method call and an embed declared


<#+ void MyPseudoGroup() {#> <#% MyEmbed #> <#+}#>


In this case when the method MyPseudoGroup is called, the content of the MyEmbed will be executed.