次の方法で共有


RazorTemplateEngine.GenerateCode メソッド

定義

オーバーロード

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

TextBuffer で指定されたテンプレートを解析し、そのコードを生成し、構築されたコードを返します。

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

によって指定された内容を inputStream 解析し、生成されたコードを返します。

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

パラメーター

input
TextReader
className
String
rootNamespace
String
sourceFileName
String

戻り値

適用対象

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

TextBuffer で指定されたテンプレートを解析し、そのコードを生成し、構築されたコードを返します。

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

パラメーター

input
ITextBuffer

解析する入力テキスト。

className
String

ホストで指定されているものをオーバーライドする、生成されたクラスの名前。 この引数に null を指定することで、既定値 (Host で定義) を使用できます。

rootNamespace
String

生成されたクラスが存在する名前空間。ホストで指定されているものはすべてオーバーライドされます。 この引数に null を指定することで、既定値 (Host で定義) を使用できます。

sourceFileName
String

行プラグマで使用するファイル名 (通常は元の Razor ファイル) は、ホストで指定されているものをオーバーライドします。 この引数に null を指定することで、既定値 (Host で定義) を使用できます。

cancelToken
Nullable<CancellationToken>

解析の取り消しに使用するトークン。

戻り値

結果として得られる解析ツリーと生成されたコード。

注釈

指定されたキャンセル トークンを使用して、解析を取り消すことができます。 ただし、解析は呼び出し元スレッドで _synchronously_、 が発生します。 このパラメーターは、呼び出し元が CancellationToken を持つバックグラウンド スレッド内にある場合に、それをパーサーに渡すことができるように提供されます。

className、rootNamespace、sourceFileName の各パラメーターは省略可能であり、Host で指定された既定値をオーバーライドします。 たとえば、System.Web.WebPages.Razor の WebPageRazorHost は、コンパイルされるページの仮想パスに基づいて、クラス名、ルート名前空間、ソース ファイル名を構成します。 ただし、組み込みの RazorEngineHost クラスでは定数の既定値が使用されるため、呼び出し元はこれらのパラメーターを使用して変更する必要がある可能性があります。

適用対象

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

パラメーター

input
TextReader
className
String
rootNamespace
String
sourceFileName
String

戻り値

適用対象

GenerateCode(Stream, String, String, String)

によって指定された内容を inputStream 解析し、生成されたコードを返します。

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

パラメーター

inputStream
Stream

Stream解析する内容を表す 。

className
String

生成されたクラスの名前。 の場合 null、既定値は DefaultClassName (Host.DefaultClassName) です。

rootNamespace
String

生成されたクラスが存在する名前空間。 の場合 null、既定値は DefaultNamespace (Host.DefaultNamespace) です。

sourceFileName
String

行プラグマで使用するファイル名 (通常は元の Razor ファイル)。

戻り値

GeneratorResultsコンテンツの解析結果を表す 。

注釈

このオーバーロードは、コード生成前の の内容の inputStream チェックサムを計算します。 チェックサムは、デバッグに必要な行プラグマを #pragma checksum 生成するために使用されます。

適用対象

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

パラメーター

input
ITextBuffer
className
String
rootNamespace
String
sourceFileName
String

戻り値

適用対象

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

パラメーター

input
TextReader

戻り値

適用対象

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

パラメーター

input
ITextBuffer

戻り値

適用対象

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

パラメーター

input
TextReader

戻り値

適用対象

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

パラメーター

input
ITextBuffer

戻り値

適用対象