Metoda RequiresProvidesDirectiveProcessor.GeneratePreInitializationCode —
Gdy zastąpiony w klasie pochodnej, dodaje kod do kodu inicjowania klasy generowane transformacji.Ten kod zostanie dodany przed klasy podstawowej jest zainicjowany.
Przestrzeń nazw: Microsoft.VisualStudio.TextTemplating
Zestaw: Microsoft.VisualStudio.TextTemplating.11.0 (w Microsoft.VisualStudio.TextTemplating.11.0.dll)
Składnia
'Deklaracja
Protected MustOverride Sub GeneratePreInitializationCode ( _
directiveName As String, _
codeBuffer As StringBuilder, _
languageProvider As CodeDomProvider, _
requiresArguments As IDictionary(Of String, String), _
providesArguments As IDictionary(Of String, String) _
)
protected abstract void GeneratePreInitializationCode(
string directiveName,
StringBuilder codeBuffer,
CodeDomProvider languageProvider,
IDictionary<string, string> requiresArguments,
IDictionary<string, string> providesArguments
)
protected:
virtual void GeneratePreInitializationCode(
String^ directiveName,
StringBuilder^ codeBuffer,
CodeDomProvider^ languageProvider,
IDictionary<String^, String^>^ requiresArguments,
IDictionary<String^, String^>^ providesArguments
) abstract
abstract GeneratePreInitializationCode :
directiveName:string *
codeBuffer:StringBuilder *
languageProvider:CodeDomProvider *
requiresArguments:IDictionary<string, string> *
providesArguments:IDictionary<string, string> -> unit
protected abstract function GeneratePreInitializationCode(
directiveName : String,
codeBuffer : StringBuilder,
languageProvider : CodeDomProvider,
requiresArguments : IDictionary<String, String>,
providesArguments : IDictionary<String, String>
)
Parametry
- directiveName
Typ: System.String
Nazwa tej dyrektywy.
- codeBuffer
Typ: System.Text.StringBuilder
Bufor, który łączy kod, który wszystkie procesory w dyrektywie, należy uruchomić przed klasy podstawowej jest inicjowany podczas przetwarzania, uruchom.Każdy kod, który niniejszej dyrektywy procesora należy uruchomić do celów niniejszej dyrektywy, przed jest zainicjowana klasa podstawowa powinna zostać dołączona do tego buforu.
- languageProvider
Typ: System.CodeDom.Compiler.CodeDomProvider
Generator kodu, który tworzy kod, aby dodać do codebuffer.
- requiresArguments
Typ: System.Collections.Generic.IDictionary<String, String>
Standardowe parametry, które wymaga procesora w dyrektywie.
- providesArguments
Typ: System.Collections.Generic.IDictionary<String, String>
Standard parametry, które przewiduje dyrektywa procesora.
Uwagi
Ponieważ GenerateTransformCode można dodawać metody do klasy transformacji wygenerowany kod inicjujący często jest niezbędny do wywoływania tych metod.
Ta metoda jest wywoływana raz dla każdej dyrektywy, która przetwarza tego procesora.W związku z tym, można dołączyć kod do każdej dyrektywy codeBuffer.GetPreInitializationCodeForProcessingRunzwraca zawartość codeBuffer po przetworzeniu wszystkich dyrektyw.
Ta metoda jest wywoływana ProcessDirective.
Przykłady
Ten przykład generuje kod, który jest uruchamiany przed klasy podstawowej jest zainicjowany.W tym przykładzie jest częścią większej przykład RequiresProvidesDirectiveProcessor klasy.
protected override void GeneratePreInitializationCode(string directiveName, StringBuilder codeBuffer, System.CodeDom.Compiler.CodeDomProvider languageProvider, IDictionary<string, string> requiresArguments, IDictionary<string, string> providesArguments)
{
if (StringComparer.InvariantCultureIgnoreCase.Compare(directiveName, DomDirectiveTag) == 0)
{
// Add your code for the pre-initialize stage for this processor.
}
}
Zabezpieczenia programu .NET Framework
- Pełne zaufanie do bezpośredniego wywołującego. Tego elementu członkowskiego nie można używać w kodzie częściowo zaufanym. Aby uzyskać więcej informacji, zobacz Przy użyciu bibliotek z częściowo zaufanego kodu..
Zobacz też
Informacje
RequiresProvidesDirectiveProcessor Klasa
Przestrzeń nazw Microsoft.VisualStudio.TextTemplating