Sdílet prostřednictvím


ITextTemplatingEngineHost.ProvideTemplatingAppDomain – metoda

Poskytuje aplikační domény spustit třídy vygenerované transformace.

Obor názvů:  Microsoft.VisualStudio.TextTemplating
Sestavení:  Microsoft.VisualStudio.TextTemplating.Interfaces.10.0 (v Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll)

Syntaxe

'Deklarace
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

Parametry

  • content
    Typ: System.String
    Obsah textového souboru šablony ke zpracování.

Vrácená hodnota

Typ: System.AppDomain
AppDomain , Zkompiluje a spustí třída vygenerované transformace

Poznámky

Hostitele lze použít content parametr poskytnout konkrétní AppDomain v závislosti na textový soubor šablony zpracovat. Například může hostitel mezipaměti AppDomain Pokud stejný soubor šablony text je zpracovávána opakovaně. Hostitele lze ignorovat content parametr, pokud hostitel není nutné informace.

Příklady

Následující příklad kódu ukazuje možné provedení vlastního hostitele. Příklad kódu je součástí větší příklad. Pro plný příklad, viz Walkthrough: Vytváření Uživatelský text šablona hostitel.

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

Zabezpečení rozhraní .NET Framework

Viz také

Odkaz

ITextTemplatingEngineHost Rozhraní

Microsoft.VisualStudio.TextTemplating – obor názvů

AppDomain

Další zdroje

Walkthrough: Vytváření Uživatelský text šablona hostitel