RazorTemplateEngine.GenerateCode Método

Definição

Sobrecargas

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

Analisa o modelo especificado pelo TextBuffer, gera código para ele e retorna o código construído.

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

Analisa o conteúdo especificado pelo inputStream e retorna o código gerado.

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

Parâmetros

input
TextReader
className
String
rootNamespace
String
sourceFileName
String

Retornos

Aplica-se a

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

Analisa o modelo especificado pelo TextBuffer, gera código para ele e retorna o código construído.

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

Parâmetros

input
ITextBuffer

O texto de entrada a analisar.

className
String

O nome da classe gerada, substituindo o que for especificado no Host. O valor padrão (definido no Host) pode ser usado fornecendo nulo para esse argumento.

rootNamespace
String

O namespace no qual a classe gerada residirá, substituindo o que for especificado no Host. O valor padrão (definido no Host) pode ser usado fornecendo nulo para esse argumento.

sourceFileName
String

O nome do arquivo a ser usado em pragmas de linha, geralmente o arquivo Razor original, substituindo o que for especificado no Host. O valor padrão (definido no Host) pode ser usado fornecendo nulo para esse argumento.

cancelToken
Nullable<CancellationToken>

Um token usado para cancelar o analisador.

Retornos

A árvore de análise resultante e o código gerado.

Comentários

O token de cancelamento fornecido pode ser usado para cancelar a análise. No entanto, observe que a análise ocorre _synchronously_, no thread de chamadores. Esse parâmetro é fornecido para que, se o chamador estiver em um thread em segundo plano com um CancellationToken, ele poderá passá-lo para o analisador.

Os parâmetros className, rootNamespace e sourceFileName são opcionais e substituem o padrão especificado pelo Host. Por exemplo, o WebPageRazorHost em System.Web.WebPages.Razor configura o Nome da Classe, o Namespace Raiz e o Nome do Arquivo de Origem com base no caminho virtual da página que está sendo compilada. No entanto, a classe RazorEngineHost interna usa padrões constantes, portanto, o chamador provavelmente desejará alterá-los usando esses parâmetros.

Aplica-se a

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

Parâmetros

input
TextReader
className
String
rootNamespace
String
sourceFileName
String

Retornos

Aplica-se a

GenerateCode(Stream, String, String, String)

Analisa o conteúdo especificado pelo inputStream e retorna o código gerado.

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

Parâmetros

inputStream
Stream

Um Stream que representa o conteúdo a ser analisado.

className
String

O nome da classe gerada. Quando null, o padrão é DefaultClassName (Host.DefaultClassName).

rootNamespace
String

O namespace no qual a classe gerada residirá. Quando null, o padrão é DefaultNamespace (Host.DefaultNamespace).

sourceFileName
String

O nome do arquivo a ser usado em pragmas de linha, geralmente o arquivo Razor original.

Retornos

Um GeneratorResults que representa os resultados da análise do conteúdo.

Comentários

Essa sobrecarga calcula a soma de verificação do conteúdo de antes da geração de inputStream código. A soma de verificação é usada para produzir o #pragma checksum pragma de linha necessário para depuração.

Aplica-se a

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

Parâmetros

input
ITextBuffer
className
String
rootNamespace
String
sourceFileName
String

Retornos

Aplica-se a

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

Parâmetros

input
TextReader

Retornos

Aplica-se a

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

Parâmetros

input
ITextBuffer

Retornos

Aplica-se a

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

Parâmetros

input
TextReader

Retornos

Aplica-se a

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

Parâmetros

input
ITextBuffer

Retornos

Aplica-se a