DirectiveProcessor.GetPreInitializationCodeForProcessingRun Method
When overridden in a derived class, gets code to add to the start of the initialize method of the generated transformation class.
Namespace: Microsoft.VisualStudio.TextTemplating
Assembly: Microsoft.VisualStudio.TextTemplating.12.0 (in Microsoft.VisualStudio.TextTemplating.12.0.dll)
Syntax
'Declaration
Public MustOverride Function GetPreInitializationCodeForProcessingRun As String
public abstract string GetPreInitializationCodeForProcessingRun()
public:
virtual String^ GetPreInitializationCodeForProcessingRun() abstract
abstract GetPreInitializationCodeForProcessingRun : unit -> string
public abstract function GetPreInitializationCodeForProcessingRun() : String
Return Value
Type: System.String
A String that contains the code to add to the generated transformation class.
Implements
IDirectiveProcessor.GetPreInitializationCodeForProcessingRun
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 following pseudo-code shows what the Initialize method of the generated transformation class might resemble:
Method GeneratedTransformationClassInstance.Initialize()
{
<code added by GetPreInitializationCodeForProcessingRun()>
base.Initialize() *This is a call to TextTransformation.Initialize()
<code added by GetPostInitializationCodeForProcessingRun()>
}
Examples
The following code example shows a possible implementation for a custom directive processor. This code example is part of a larger example provided for the DirectiveProcessor class.
public override string GetPreInitializationCodeForProcessingRun()
{
//We do not need any pre-initialization, so we will just return "".
//-----------------------------------------------------------------
return String.Empty;
}
Public Overrides Function GetPreInitializationCodeForProcessingRun() As String
'We do not need any pre-initialization, so we will just return "".
'-----------------------------------------------------------------
Return String.Empty
End Function
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.VisualStudio.TextTemplating Namespace
GetPostInitializationCodeForProcessingRun
GetPreInitializationCodeForProcessingRun