按一下以給予評分及指教
MSDN
MSDN Library
Visual Studio
 ProvideTemplatingAppDomain Method

  開啟低頻寬檢視
Domain-Specific Language Tools Reference
ITextTemplatingEngineHost..::.ProvideTemplatingAppDomain Method

Provides an application domain to run the generated transformation class.

Namespace:  Microsoft.VisualStudio.TextTemplating
Assembly:  Microsoft.VisualStudio.TextTemplating (in Microsoft.VisualStudio.TextTemplating.dll)

Visual Basic (Declaration)
Function ProvideTemplatingAppDomain ( _
    content As String _
) As AppDomain
Visual Basic (Usage)
Dim instance As ITextTemplatingEngineHost
Dim content As String
Dim returnValue As AppDomain

returnValue = instance.ProvideTemplatingAppDomain(content)
C#
AppDomain ProvideTemplatingAppDomain(
    string content
)
Visual C++
AppDomain^ ProvideTemplatingAppDomain(
    String^ content
)
JScript
function ProvideTemplatingAppDomain(
    content : String
) : AppDomain

Parameters

content
Type: System..::.String

The contents of the text template file to be processed.

Return Value

Type: System..::.AppDomain

An AppDomain that compiles and executes the generated transformation class.

The host can use the content parameter to provide a specific AppDomain depending on the text template file to be processed. For example, the host could cache an AppDomain if the same text template file is being processed repeatedly. The host can ignore the content parameter if the host does not need the information.

The following code example shows a possible implementation for a custom host. This code example is part of a larger example provided for the ITextTemplatingEngineHost interface.

C#
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
}
Visual Basic
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
社群內容   什麼是社群內容?
新增內容 RSS  註解
Processing
© 2009 Microsoft Corporation. 著作權所有,並保留一切權利。 使用規定  |  商標  |  隱私權聲明
Page view tracker