Share via


TextTransformation.Initialize Method

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Initializes the TextTransformation class.

Namespace:  Microsoft.VisualStudio.TextTemplating
Assembly:  Microsoft.VisualStudio.TextTemplating.12.0 (in Microsoft.VisualStudio.TextTemplating.12.0.dll)

Syntax

'Declaration
Public Overridable Sub Initialize
public virtual void Initialize()
public:
virtual void Initialize()
abstract Initialize : unit -> unit  
override Initialize : unit -> unit
public function Initialize()

Remarks

Directive processors can add code to the override of this method in the generated transformation class by adding code to the GetPreInitializationCodeForProcessingRun and GetPostInitializationCodeForProcessingRun. GetPreInitializationCodeForProcessingRun adds code to the beginning of the Initialize method, and GetPostInitializationCodeForProcessingRun adds code to the end of the Initialize method.

For example, the following pseudo-code shows what the Initialize method of the generated transformation class might look like:

Method GeneratedTransformationClassInstance.Initialize()

{

<code added by GetPreInitializationCodeForProcessingRun()>

base.Initialize() *This is a call to TextTransformation.Initialize()

<code added by GetPostInitializationCodeForProcessingRun()>

}

You can log an error during Initialize to stop the text template transformation process. The transformation engine checks the Errors property of the TextTransformation class after Initialize completes, and stops processing if it contains any errors.

.NET Framework Security

See Also

Reference

TextTransformation Class

Microsoft.VisualStudio.TextTemplating Namespace

DirectiveProcessor

GetPreInitializationCodeForProcessingRun

GetPostInitializationCodeForProcessingRun

Other Resources

Creating Custom T4 Text Template Directive Processors