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 (in Microsoft.VisualStudio.TextTemplating.dll)

Syntax

'Declaration
Protected Friend Overridable Sub Initialize
'Usage
Me.Initialize()
protected internal virtual void Initialize()
protected public:
virtual void Initialize()
protected internal 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

TextTransformation Members

Microsoft.VisualStudio.TextTemplating Namespace

DirectiveProcessor

GetPreInitializationCodeForProcessingRun

GetPostInitializationCodeForProcessingRun

Other Resources

Creating Custom Text Template Directive Processors