User Tools

Site Tools


template_helper_blocks.htm
Navigation:  T4 Template Language Reference > Directives >Class Statement blocks Previous pageReturn to chapter overviewNext page

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.

Examples:

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.

template_helper_blocks.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1