RazorTemplateEngine.GenerateCode Metoda
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Přetížení
| GenerateCode(TextReader, String, String, String, Nullable<CancellationToken>) | |
| GenerateCode(ITextBuffer, String, String, String, Nullable<CancellationToken>) |
Analyzuje šablonu určenou pomocí TextBuffer, vygeneruje pro ni kód a vrátí vytvořený kód. |
| GenerateCode(TextReader, String, String, String) | |
| GenerateCode(Stream, String, String, String) |
Analyzuje obsah zadaný pomocí |
| GenerateCode(ITextBuffer, String, String, String) | |
| GenerateCode(TextReader, Nullable<CancellationToken>) | |
| GenerateCode(ITextBuffer, Nullable<CancellationToken>) | |
| GenerateCode(TextReader) | |
| GenerateCode(ITextBuffer) |
GenerateCode(TextReader, String, String, String, Nullable<CancellationToken>)
public:
Microsoft::AspNetCore::Razor::CodeGenerators::GeneratorResults ^ GenerateCode(System::IO::TextReader ^ input, System::String ^ className, System::String ^ rootNamespace, System::String ^ sourceFileName, Nullable<System::Threading::CancellationToken> cancelToken);
public Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults GenerateCode (System.IO.TextReader input, string className, string rootNamespace, string sourceFileName, System.Threading.CancellationToken? cancelToken);
member this.GenerateCode : System.IO.TextReader * string * string * string * Nullable<System.Threading.CancellationToken> -> Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults
Public Function GenerateCode (input As TextReader, className As String, rootNamespace As String, sourceFileName As String, cancelToken As Nullable(Of CancellationToken)) As GeneratorResults
Parametry
- input
- TextReader
- className
- String
- rootNamespace
- String
- sourceFileName
- String
- cancelToken
- Nullable<CancellationToken>
Návraty
Platí pro
GenerateCode(ITextBuffer, String, String, String, Nullable<CancellationToken>)
Analyzuje šablonu určenou pomocí TextBuffer, vygeneruje pro ni kód a vrátí vytvořený kód.
public:
Microsoft::AspNetCore::Razor::CodeGenerators::GeneratorResults ^ GenerateCode(Microsoft::AspNetCore::Razor::Text::ITextBuffer ^ input, System::String ^ className, System::String ^ rootNamespace, System::String ^ sourceFileName, Nullable<System::Threading::CancellationToken> cancelToken);
public Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults GenerateCode (Microsoft.AspNetCore.Razor.Text.ITextBuffer input, string className, string rootNamespace, string sourceFileName, System.Threading.CancellationToken? cancelToken);
member this.GenerateCode : Microsoft.AspNetCore.Razor.Text.ITextBuffer * string * string * string * Nullable<System.Threading.CancellationToken> -> Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults
Public Function GenerateCode (input As ITextBuffer, className As String, rootNamespace As String, sourceFileName As String, cancelToken As Nullable(Of CancellationToken)) As GeneratorResults
Parametry
- input
- ITextBuffer
Vstupní text, který se má analyzovat
- className
- String
Název generované třídy, v němž je přepsáno, pokud je v hostiteli určena možnost bez přepsání. Výchozí hodnotu (definovanou v hostiteli) lze použít pro zadání hodnoty null pro tento argument.
- rootNamespace
- String
Obor názvů, ve kterém bude vygenerovaná třída umístěna, přepisují, co je zadáno na hostiteli. Výchozí hodnotu (definovanou v hostiteli) lze použít pro zadání hodnoty null pro tento argument.
- sourceFileName
- String
Název souboru, který má být použit v direktivách pragma řádku, obvykle v původním souboru Razor, přičemž přepíše vše, co je zadáno na hostiteli. Výchozí hodnotu (definovanou v hostiteli) lze použít pro zadání hodnoty null pro tento argument.
- cancelToken
- Nullable<CancellationToken>
Token, který slouží ke zrušení analyzátoru.
Návraty
Výsledný strom analýzy a generovaný kód.
Poznámky
K zrušení analýzy lze použít poskytnutý token Cancel. Nicméně Všimněte si, že analýza probíhá _synchronně_, v vlákně volajících. Tento parametr je k dispozici, aby v případě, že je volající ve vlákně na pozadí s CancellationToken, mohl předat do analyzátoru.
Parametry className, rootNamespace a sourceFileName jsou volitelné a přepisují výchozí hodnoty určené hostitelem. Například WebPageRazorHost v System. Web. webpages. Razor nakonfiguruje název třídy, kořenový obor názvů a název zdrojového souboru na základě virtuální cesty kompilované stránky. Integrovaná třída RazorEngineHost však používá konstantní výchozí hodnoty, takže volající je bude nejspíš chtít změnit pomocí těchto parametrů.
Platí pro
GenerateCode(TextReader, String, String, String)
public:
Microsoft::AspNetCore::Razor::CodeGenerators::GeneratorResults ^ GenerateCode(System::IO::TextReader ^ input, System::String ^ className, System::String ^ rootNamespace, System::String ^ sourceFileName);
public Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults GenerateCode (System.IO.TextReader input, string className, string rootNamespace, string sourceFileName);
member this.GenerateCode : System.IO.TextReader * string * string * string -> Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults
Public Function GenerateCode (input As TextReader, className As String, rootNamespace As String, sourceFileName As String) As GeneratorResults
Parametry
- input
- TextReader
- className
- String
- rootNamespace
- String
- sourceFileName
- String
Návraty
Platí pro
GenerateCode(Stream, String, String, String)
Analyzuje obsah zadaný pomocí inputStream a vrátí generovaný kód.
public:
Microsoft::AspNetCore::Razor::CodeGenerators::GeneratorResults ^ GenerateCode(System::IO::Stream ^ inputStream, System::String ^ className, System::String ^ rootNamespace, System::String ^ sourceFileName);
public Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults GenerateCode (System.IO.Stream inputStream, string className, string rootNamespace, string sourceFileName);
member this.GenerateCode : System.IO.Stream * string * string * string -> Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults
Public Function GenerateCode (inputStream As Stream, className As String, rootNamespace As String, sourceFileName As String) As GeneratorResults
Parametry
- className
- String
Název generované třídy. Pokud má hodnotu null, výchozí hodnota je DefaultClassName (Host. DefaultClassName).
- rootNamespace
- String
Obor názvů, ve kterém bude vygenerovaná třída umístěna. Pokud má hodnotu null, výchozí hodnota je DefaultNamespace (Host. DefaultNamespace).
- sourceFileName
- String
Název souboru, který má být použit v direktivách pragma řádku, obvykle v původním souboru Razor.
Návraty
GeneratorResultsKterý představuje výsledky analýzy obsahu.
Poznámky
Toto přetížení vypočítá kontrolní součet obsahu inputStream před generováním kódu. Kontrolní součet se používá k vytvoření direktivy pragma #pragma řádku kontrolního součtu , která se vyžaduje pro ladění.
Platí pro
GenerateCode(ITextBuffer, String, String, String)
public:
Microsoft::AspNetCore::Razor::CodeGenerators::GeneratorResults ^ GenerateCode(Microsoft::AspNetCore::Razor::Text::ITextBuffer ^ input, System::String ^ className, System::String ^ rootNamespace, System::String ^ sourceFileName);
public Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults GenerateCode (Microsoft.AspNetCore.Razor.Text.ITextBuffer input, string className, string rootNamespace, string sourceFileName);
member this.GenerateCode : Microsoft.AspNetCore.Razor.Text.ITextBuffer * string * string * string -> Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults
Public Function GenerateCode (input As ITextBuffer, className As String, rootNamespace As String, sourceFileName As String) As GeneratorResults
Parametry
- input
- ITextBuffer
- className
- String
- rootNamespace
- String
- sourceFileName
- String
Návraty
Platí pro
GenerateCode(TextReader, Nullable<CancellationToken>)
public:
Microsoft::AspNetCore::Razor::CodeGenerators::GeneratorResults ^ GenerateCode(System::IO::TextReader ^ input, Nullable<System::Threading::CancellationToken> cancelToken);
public Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults GenerateCode (System.IO.TextReader input, System.Threading.CancellationToken? cancelToken);
member this.GenerateCode : System.IO.TextReader * Nullable<System.Threading.CancellationToken> -> Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults
Public Function GenerateCode (input As TextReader, cancelToken As Nullable(Of CancellationToken)) As GeneratorResults
Parametry
- input
- TextReader
- cancelToken
- Nullable<CancellationToken>
Návraty
Platí pro
GenerateCode(ITextBuffer, Nullable<CancellationToken>)
public:
Microsoft::AspNetCore::Razor::CodeGenerators::GeneratorResults ^ GenerateCode(Microsoft::AspNetCore::Razor::Text::ITextBuffer ^ input, Nullable<System::Threading::CancellationToken> cancelToken);
public Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults GenerateCode (Microsoft.AspNetCore.Razor.Text.ITextBuffer input, System.Threading.CancellationToken? cancelToken);
member this.GenerateCode : Microsoft.AspNetCore.Razor.Text.ITextBuffer * Nullable<System.Threading.CancellationToken> -> Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults
Public Function GenerateCode (input As ITextBuffer, cancelToken As Nullable(Of CancellationToken)) As GeneratorResults
Parametry
- input
- ITextBuffer
- cancelToken
- Nullable<CancellationToken>
Návraty
Platí pro
GenerateCode(TextReader)
public:
Microsoft::AspNetCore::Razor::CodeGenerators::GeneratorResults ^ GenerateCode(System::IO::TextReader ^ input);
public Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults GenerateCode (System.IO.TextReader input);
member this.GenerateCode : System.IO.TextReader -> Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults
Public Function GenerateCode (input As TextReader) As GeneratorResults
Parametry
- input
- TextReader
Návraty
Platí pro
GenerateCode(ITextBuffer)
public:
Microsoft::AspNetCore::Razor::CodeGenerators::GeneratorResults ^ GenerateCode(Microsoft::AspNetCore::Razor::Text::ITextBuffer ^ input);
public Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults GenerateCode (Microsoft.AspNetCore.Razor.Text.ITextBuffer input);
member this.GenerateCode : Microsoft.AspNetCore.Razor.Text.ITextBuffer -> Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults
Public Function GenerateCode (input As ITextBuffer) As GeneratorResults
Parametry
- input
- ITextBuffer