ServiceContractGenerationContext 클래스

정의

코드를 생성하기 GenerateContract(ServiceContractGenerationContext) 전에 서비스 계약 및 해당 컨텍스트를 수정할 수 있도록 메서드에 전달됩니다.

public ref class ServiceContractGenerationContext
public class ServiceContractGenerationContext
type ServiceContractGenerationContext = class
Public Class ServiceContractGenerationContext
상속
ServiceContractGenerationContext

예제

다음 예제에서는 메서드에 ServiceContractGenerationContextIServiceContractGenerationExtension.GenerateContract 전달된 개체를 사용하여 사용자 지정 WSDL 요소에서 추출된 코드 주석을 추가하는 방법을 보여 줍니다.

public void GenerateContract(ServiceContractGenerationContext context)
{
  Console.WriteLine("In generate contract.");
  context.ContractType.Comments.AddRange(Formatter.FormatComments(commentText));
}

다음 코드 예제에서는 결과 코드 주석을 보여 줍니다.

/// From WSDL Documentation:
///
/// <summary>This contract is a stateless contract that provides a mechanism for
/// computing the nth Fibonacci term.</summary>
///
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace="http://microsoft.wcf.documentation", ConfigurationName="IFibonacci")]
public interface IFibonacci
{

    /// From WSDL Documentation:
    ///
    /// <summary>The Compute operation returns the nth Fibonacci number.  Because it
    /// uses dual recursion it's very inefficient and therefore useful to demonstrate
    /// caching.</summary><returns>The nth Fibonacci number.</returns><param
    /// name="num">The value to use when computing the Fibonacci number.</param>
    ///
    [System.ServiceModel.OperationContractAttribute(Action="http://microsoft.wcf.documentation/IFibonacci/Compute", ReplyAction="http://microsoft.wcf.documentation/IFibonacci/ComputeResponse")]
    int Compute(int num);

    /// From WSDL Documentation:
    ///
    /// <summary>The GetPerson operation tests custom WSDL documentation
    /// generation.</summary><returns>The Person object to be returned.</returns><param
    /// name="FirstParameter">The value for the first parameter.</param><param
    /// name="SecondParameter">The value for the second parameter.</param>
    ///
    [System.ServiceModel.OperationContractAttribute(Action="http://microsoft.wcf.documentation/IFibonacci/GetPerson", ReplyAction="http://microsoft.wcf.documentation/IFibonacci/GetPersonResponse")]
    Microsoft.WCF.Documentation.Person GetPerson(int FirstParameter, int SecondParameter);
}

'''From WSDL Documentation:
'''
'''<summary>This contract is a stateless contract that provides a mechanism for 
'''computing the nth Fibonacci term.</summary> 
'''
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0"),  _
 System.ServiceModel.ServiceContractAttribute([Namespace]:="http://microsoft.wcf.documentation", ConfigurationName:="IFibonacci")>  _
Public Interface IFibonacci
    
    '''From WSDL Documentation:
    '''
    '''<summary>The Compute operation returns the nth Fibonacci number.  Because it 
    '''uses dual recursion it's very inefficient and therefore useful to demonstrate 
    '''caching.</summary><returns>The nth Fibonacci number.</returns><param 
    '''name="num">The value to use when computing the Fibonacci number.</param> 
    '''
    <System.ServiceModel.OperationContractAttribute(Action:="http://microsoft.wcf.documentation/IFibonacci/Compute", ReplyAction:="http://microsoft.wcf.documentation/IFibonacci/ComputeResponse")>  _
    Function Compute(ByVal num As Integer) As Integer
    
    '''From WSDL Documentation:
    '''
    '''<summary>The GetPerson operation tests custom WSDL documentation 
    '''generation.</summary><returns>The Person object to be returned.</returns><param 
    '''name="FirstParameter">The value for the first parameter.</param><param 
    '''name="SecondParameter">The value for the second parameter.</param> 
    '''
    <System.ServiceModel.OperationContractAttribute(Action:="http://microsoft.wcf.documentation/IFibonacci/GetPerson", ReplyAction:="http://microsoft.wcf.documentation/IFibonacci/GetPersonResponse")>  _
    Function GetPerson(ByVal FirstParameter As Integer, ByVal SecondParameter As Integer) As Microsoft.WCF.Documentation.Person
End Interface

설명

메서드에 ServiceContractGenerationContext 전달된 개체를 IServiceContractGenerationExtension.GenerateContract 사용하여 코드 생성 전에 코드 문서 개체 모델을 수정합니다. 일반적으로 System.ServiceModel.Description.IServiceContractGenerationExtension 인터페이스는 사용자 지정 System.ServiceModel.Description.IWsdlImportExtension WSDL 요소를 가져오거나 서비스 또는 작업 수준에서 코드를 수정하는 데 사용되는 사용자 지정 구현에서 구현됩니다. 작업 수준에서 코드를 수정하려면 다음을 참조하세요 System.ServiceModel.Description.IOperationContractGenerationExtension.

생성자

Name Description
ServiceContractGenerationContext(ServiceContractGenerator, ContractDescription, CodeTypeDeclaration, CodeTypeDeclaration)

지정된 계약 생성기, 계약 설명 및 계약 코드 형식 선언을 사용하여 클래스의 ServiceContractGenerationContext 새 인스턴스를 초기화합니다.

ServiceContractGenerationContext(ServiceContractGenerator, ContractDescription, CodeTypeDeclaration)

지정된 계약 생성기, 계약 설명 및 계약 코드 형식 선언을 사용하여 클래스의 ServiceContractGenerationContext 새 인스턴스를 초기화합니다.

속성

Name Description
Contract

ContractDescription 현재 계약의 값을 가져옵니다.

ContractType

CodeTypeDeclaration 현재 계약의 값을 가져옵니다.

DuplexCallbackType

CodeTypeDeclaration 서비스 계약의 이중 콜백 계약에 대한 값을 가져옵니다.

Operations

계약 작업을 나타내는 개체의 OperationContractGenerationContext 컬렉션을 가져옵니다.

ServiceContractGenerator

ServiceContractGenerator 계약을 생성할 항목을 가져옵니다.

메서드

Name Description
Equals(Object)

지정된 개체가 현재 개체와 같은지 여부를 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 사용됩니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상