다음을 통해 공유


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

기타 리소스

연습: 사용자 지정 텍스트 템플릿 호스트 만들기