ITextTemplatingEngineHost.ProvideTemplatingAppDomain メソッド

生成された変換クラスを実行するためのアプリケーション ドメインを提供します。

名前空間:  Microsoft.VisualStudio.TextTemplating
アセンブリ:  Microsoft.VisualStudio.TextTemplating.Interfaces.10.0 (Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll 内)

構文

'宣言
Function ProvideTemplatingAppDomain ( _
    content As String _
) As AppDomain
AppDomain ProvideTemplatingAppDomain(
    string content
)
AppDomain^ ProvideTemplatingAppDomain(
    String^ content
)
abstract ProvideTemplatingAppDomain : 
        content:string -> AppDomain 
function ProvideTemplatingAppDomain(
    content : String
) : AppDomain

パラメーター

  • content
    型 : System.String
    処理されるテキスト テンプレート ファイルの内容。

戻り値

型 : System.AppDomain
生成された変換クラスをコンパイルして実行する AppDomain

解説

ホストは content パラメーターを使用して、処理されるテキスト テンプレート ファイルに応じて特定の AppDomain を提供できます。たとえば、同じテキスト テンプレート ファイルが繰り返し処理される場合、ホストは AppDomain をキャッシュすることができます。ホストが情報を必要としない場合、ホストは content パラメーターを無視できます。

カスタム ホストを実装するコード例を次に示します。ここに示すコード例は、より長い例の一部です。コード例全体については、「チュートリアル: カスタム テキスト テンプレート ホストの作成」を参照してください。

public AppDomain ProvideTemplatingAppDomain(string content)
{
    //this host will provide a new application domain each time the 
    //engine processes a text template
    //-------------------------------------------------------------
    return AppDomain.CreateDomain("Generation App Domain");

    //this could be changed to return the current appdomain, but new 
    //assemblies are loaded into this AppDomain on a regular basis
    //if the AppDomain lasts too long, it will grow indefintely 
    //which might be regarded as a leak

    //this could be customized to cache the application domain for 
    //a certain number of text template generations (for example 10)

    //this could be customized based on the contents of the text 
    //template, which are provided as a parameter for that purpose
}
Public Function ProvideTemplatingAppDomain(ByVal content As String) As System.AppDomain Implements Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost.ProvideTemplatingAppDomain

    'this host will provide a new application domain each time the 
    'engine processes a text template
    '-------------------------------------------------------------
    Return AppDomain.CreateDomain("Generation App Domain")

    'this could be changed to return the current application domain, but new 
    'assemblies are loaded into this application domain on a regular basis
    'if the application domain lasts too long, it will grow indefintely 
    'which might be regarded as a leak

    'this could be customized to cache the application domain for 
    'a certain number of text template generations (for example 10)

    'this could be customized based on the contents of the text 
    'template, which are provided as a parameter for that purpose
End Function

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

ITextTemplatingEngineHost インターフェイス

Microsoft.VisualStudio.TextTemplating 名前空間

AppDomain

その他の技術情報

チュートリアル: カスタム テキスト テンプレート ホストの作成