Udostępnij za pośrednictwem


RazorTemplateEngine.GenerateCode Metoda

Definicja

Przeciążenia

GenerateCode(TextReader, String, String, String, Nullable<CancellationToken>)
GenerateCode(ITextBuffer, String, String, String, Nullable<CancellationToken>)

Analizuje szablon określony przez element TextBuffer, generuje dla niego kod i zwraca skonstruowany kod.

GenerateCode(TextReader, String, String, String)
GenerateCode(Stream, String, String, String)

Analizuje zawartość określoną przez inputStream obiekt i zwraca wygenerowany kod.

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

Zwraca

Dotyczy

GenerateCode(ITextBuffer, String, String, String, Nullable<CancellationToken>)

Analizuje szablon określony przez element TextBuffer, generuje dla niego kod i zwraca skonstruowany kod.

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

Tekst wejściowy do analizy.

className
String

Nazwa wygenerowanej klasy, przesłaniając dowolną wartość określoną w hoście. Wartość domyślna (zdefiniowana w hoście) może być używana przez podanie wartości null dla tego argumentu.

rootNamespace
String

Przestrzeń nazw, w której będzie znajdować się wygenerowana klasa, przesłaniając elementy określone w hoście. Wartość domyślna (zdefiniowana w hoście) może być używana przez podanie wartości null dla tego argumentu.

sourceFileName
String

Nazwa pliku do użycia w wierszach pragmas, zwykle oryginalny plik Razor, przesłaniając to, co jest określone w hoście. Wartość domyślna (zdefiniowana w hoście) może być używana przez podanie wartości null dla tego argumentu.

cancelToken
Nullable<CancellationToken>

Token używany do anulowania analizatora.

Zwraca

Wynikowe drzewo analizy i wygenerowany kod.

Uwagi

Podany token anulowania może służyć do anulowania analizy. Należy jednak pamiętać, że analizowanie występuje _synchronously_, w wątku wywołujących. Ten parametr jest dostarczany, aby jeśli obiekt wywołujący znajduje się w wątku w tle z elementem CancellationToken, może przekazać go do analizatora.

Parametry className, rootNamespace i sourceFileName są opcjonalne i zastępują wartość domyślną określoną przez hosta. Na przykład webPageRazorHost w system.Web.WebPages.Razor konfiguruje nazwę klasy, przestrzeń nazw głównych i nazwę pliku źródłowego na podstawie ścieżki wirtualnej skompilowanej strony. Jednak wbudowana klasa RazorEngineHost używa stałych wartości domyślnych, więc obiekt wywołujący prawdopodobnie będzie chciał je zmienić przy użyciu tych parametrów.

Dotyczy

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

Zwraca

Dotyczy

GenerateCode(Stream, String, String, String)

Analizuje zawartość określoną przez inputStream obiekt i zwraca wygenerowany kod.

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

inputStream
Stream

Element Stream reprezentujący zawartość, która ma zostać przeanalizowana.

className
String

Nazwa wygenerowanej klasy. Gdy nullwartość domyślna DefaultClassName to (Host.DefaultClassName).

rootNamespace
String

Przestrzeń nazw, w której będzie znajdować się wygenerowana klasa. Gdy nullwartość domyślna DefaultNamespace to (Host.DefaultNamespace).

sourceFileName
String

Nazwa pliku do użycia w wierszach pragmas, zwykle oryginalny plik Razor.

Zwraca

Element GeneratorResults reprezentujący wyniki analizowania zawartości.

Uwagi

To przeciążenie oblicza sumę kontrolną zawartości przed inputStream generowaniem kodu. Suma kontrolna jest używana do tworzenia pragma linii wymaganej #pragma checksum do debugowania.

Dotyczy

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

Zwraca

Dotyczy

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

Zwraca

Dotyczy

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

Zwraca

Dotyczy

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

Zwraca

Dotyczy

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

Zwraca

Dotyczy