Condividi tramite


DirectiveProcessor.StartProcessingRun Method

When overridden in a derived class, starts a round of directive processing.

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

Syntax

'Declaration
Public Overridable Sub StartProcessingRun ( _
    languageProvider As CodeDomProvider, _
    templateContents As String, _
    errors As CompilerErrorCollection _
)
public virtual void StartProcessingRun(
    CodeDomProvider languageProvider,
    string templateContents,
    CompilerErrorCollection errors
)
public:
virtual void StartProcessingRun(
    CodeDomProvider^ languageProvider, 
    String^ templateContents, 
    CompilerErrorCollection^ errors
)
abstract StartProcessingRun : 
        languageProvider:CodeDomProvider * 
        templateContents:string * 
        errors:CompilerErrorCollection -> unit  
override StartProcessingRun : 
        languageProvider:CodeDomProvider * 
        templateContents:string * 
        errors:CompilerErrorCollection -> unit
public function StartProcessingRun(
    languageProvider : CodeDomProvider, 
    templateContents : String, 
    errors : CompilerErrorCollection
)

Parameters

  • templateContents
    Type: System.String

    The contents of the text template that is being processed.

Implements

IDirectiveProcessor.StartProcessingRun(CodeDomProvider, String, CompilerErrorCollection)

Remarks

The default language provider is CSharpCodeProvider.

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 void StartProcessingRun(CodeDomProvider languageProvider, String templateContents, CompilerErrorCollection errors)
{
    //the engine has passed us the language of the text template
    //we will use that language to generate code later
    //----------------------------------------------------------
    this.codeDomProvider = languageProvider;
    this.templateContents = templateContents;
    this.errorsValue = errors;

    this.codeBuffer = new StringBuilder();
}
Public Overrides Sub StartProcessingRun(ByVal languageProvider As CodeDomProvider, ByVal templateContents As String, ByVal errors As CompilerErrorCollection)

    'the engine has passed us the language of the text template
    'we will use that language to generate code later
    '----------------------------------------------------------
    Me.codeDomProvider = languageProvider
    Me.templateContents = templateContents
    Me.errorsValue = errors

    Me.codeBuffer = New StringBuilder()
End Sub

.NET Framework Security

See Also

Reference

DirectiveProcessor Class

Microsoft.VisualStudio.TextTemplating Namespace

FinishProcessingRun

CodeDomProvider

VBCodeProvider

CSharpCodeProvider

StartProcessingRun

Other Resources

Creating Custom T4 Text Template Directive Processors

Walkthrough: Creating a Custom Directive Processor