RequiresProvidesDirectiveProcessor.GetPreInitializationCodeForProcessingRun Method

Gets code to initialize when the generated transformation class is initialized, as a consequence of the most recent processing run.

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

Syntax

'Declaration
Public Overrides Function GetPreInitializationCodeForProcessingRun As String
public override string GetPreInitializationCodeForProcessingRun()
public:
virtual String^ GetPreInitializationCodeForProcessingRun() override
abstract GetPreInitializationCodeForProcessingRun : unit -> string  
override GetPreInitializationCodeForProcessingRun : unit -> string
public override function GetPreInitializationCodeForProcessingRun() : String

Return Value

Type: String
A String that contains the code to add to the generated transformation class.

Implements

IDirectiveProcessor.GetPreInitializationCodeForProcessingRun()

Exceptions

Exception Condition
InvalidOperationException

A processing run has already started but not yet finished.

Remarks

This method adds code to the start of the Initialize method of the generated transformation class. The Initialize method of the generated transformation class contains a call to the Initialize method of the base class, and this code is added before that call. For example, the Initialize method of the generated transformation class might resemble the following example:

Method GeneratedTransformationClassInstance.Initialize()
{
    <code added by GetPreInitializationCodeForProcessingRun()>

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

    <code added by GetPostInitializationCodeForProcessingRun()>
}

This method is overridden in RequiresProvidesDirectiveProcessor to return the contents of the codeBuffer passed to the GeneratePreInitializationCode method. You do not usually need to override this method in classes that derive from RequiresProvidesDirectiveProcessor.

.NET Framework Security

See Also

Reference

RequiresProvidesDirectiveProcessor Class

Microsoft.VisualStudio.TextTemplating Namespace

GetPostInitializationCodeForProcessingRun

GetPreInitializationCodeForProcessingRun

GeneratePreInitializationCode

Other Resources

Creating Custom T4 Text Template Directive Processors