다음을 통해 공유


OperationContractGenerationContext 클래스

정의

코드를 생성하기 전에 작업 계약과 해당 컨텍스트를 수정할 수 있도록 GenerateOperation(OperationContractGenerationContext) 메서드에 전달됩니다.

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

예제

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

public void GenerateOperation(OperationContractGenerationContext context)
{
  context.SyncMethod.Comments.AddRange(Formatter.FormatComments(commentText));
  Console.WriteLine("In generate operation.");
}

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

/// 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

설명

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

생성자

OperationContractGenerationContext(ServiceContractGenerator, ServiceContractGenerationContext, OperationDescription, CodeTypeDeclaration, CodeMemberMethod)

지정한 계약 생성기, 계약 컨텍스트, 작업 설명, 코드 형식 선언, 동기화 메서드 및 작업 메서드를 사용하여 OperationContractGenerationContext 클래스의 새 인스턴스를 초기화합니다.

OperationContractGenerationContext(ServiceContractGenerator, ServiceContractGenerationContext, OperationDescription, CodeTypeDeclaration, CodeMemberMethod, CodeMemberMethod)

지정한 계약 생성기, 계약 컨텍스트, 작업 설명, 코드 형식 선언 및 메서드를 사용하여 OperationContractGenerationContext 클래스의 새 인스턴스를 초기화합니다.

OperationContractGenerationContext(ServiceContractGenerator, ServiceContractGenerationContext, OperationDescription, CodeTypeDeclaration, CodeMemberMethod, CodeMemberMethod, CodeMemberMethod)

OperationContractGenerationContext 클래스의 새 인스턴스를 초기화합니다.

OperationContractGenerationContext(ServiceContractGenerator, ServiceContractGenerationContext, OperationDescription, CodeTypeDeclaration, CodeMemberMethod, CodeMemberMethod, CodeMemberMethod, CodeMemberMethod)

지정한 계약 생성기, 계약 컨텍스트, 작업 설명, 코드 형식 선언, 동기화 메서드, begin 메서드, end 메서드 및 작업 메서드를 사용하여 OperationContractGenerationContext 클래스의 새 인스턴스를 초기화합니다.

속성

BeginMethod

비동기 Begin 작업에 대한 CodeMemberMethod를 가져옵니다.

Contract

서비스 계약에 대한 코드 생성 컨텍스트를 가져옵니다.

DeclaringType

현재 작업에 대한 선언 형식을 가져옵니다.

EndMethod

비동기 End 작업 선언을 가져옵니다.

IsAsync

현재 작업에 대해 비동기 메서드가 생성되는지 여부를 나타내는 값을 가져옵니다.

IsTask

현재 작업에 대해 작업이 생성되는지 여부를 나타내는 값을 가져옵니다.

Operation

현재 작업에 대한 OperationDescription을 가져옵니다.

ServiceContractGenerator

현재 작업을 생성하는 ServiceContractGenerator를 가져옵니다.

SyncMethod

동기 작업에 대한 CodeMemberMethod를 가져옵니다.

TaskMethod

작업에 대한 CodeMemberMethod를 가져옵니다.

메서드

Equals(Object)

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

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

기본 해시 함수로 작동합니다.

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

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

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

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

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

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

(다음에서 상속됨 Object)

적용 대상