OperationDescription 클래스

정의

계약 작업에 대한 설명으로, 작업을 구성하는 메시지에 대한 설명을 제공합니다.

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

예제

다음 예에서는 클래스의 OperationDescription 속성에서 반환된 컬렉션에서 반환된 Operations ContractDescription 값을 사용합니다. 이 코드는 엔드포인트 컬렉션을 반복하고 엔드포인트의 각 작업 이름과 각 엔드포인트 이름을 출력합니다.

private void PrintDescription(ServiceHost sh)
{
    // Declare variables.
    int i, j, k, l, c;
    ServiceDescription servDesc = sh.Description;
    OperationDescription opDesc;
    ContractDescription contractDesc;
    MessageDescription methDesc;
    MessageBodyDescription mBodyDesc;
    MessagePartDescription partDesc;
    IServiceBehavior servBeh;
    ServiceEndpoint servEP;

    // Print the behaviors of the service.
    Console.WriteLine("Behaviors:");
    for (c = 0; c < servDesc.Behaviors.Count; c++)
    {
        servBeh = servDesc.Behaviors[c];
        Console.WriteLine("\t{0}", servBeh.ToString());
    }

    // Print the endpoint descriptions of the service.
    Console.WriteLine("Endpoints");
    for (i = 0; i < servDesc.Endpoints.Count; i++)
    {
        // Print the endpoint names.
        servEP = servDesc.Endpoints[i];
        Console.WriteLine("\tName: {0}", servEP.Name);
        contractDesc = servEP.Contract;

        Console.WriteLine("\tOperations:");
        for (j = 0; j < contractDesc.Operations.Count; j++)
        {
            // Print the operation names.
            opDesc = servEP.Contract.Operations[j];
            Console.WriteLine("\t\t{0}", opDesc.Name);
            Console.WriteLine("\t\tActions:");
            for (k  = 0; k < opDesc.Messages.Count; k++)
            {
                // Print the message action.
                methDesc = opDesc.Messages[k];
                Console.WriteLine("\t\t\tAction:{0}", methDesc.Action);

                // Check for the existence of a body, then the body description.
                mBodyDesc = methDesc.Body;
                if (mBodyDesc.Parts.Count > 0)
                {
                    for (l = 0; l < methDesc.Body.Parts.Count; l++)
                    {
                        partDesc = methDesc.Body.Parts[l];
                        Console.WriteLine("\t\t\t\t{0}",partDesc.Name);
                    }
                }
            }
        }
    }
}
Private Sub PrintDescription(ByVal sh As ServiceHost) 
    ' Declare variables.
    Dim i, j, k, l, c As Integer
    Dim servDesc As ServiceDescription = sh.Description
    Dim opDesc As OperationDescription
    Dim contractDesc As ContractDescription
    Dim methDesc As MessageDescription
    Dim mBodyDesc As MessageBodyDescription
    Dim partDesc As MessagePartDescription
    Dim servBeh As IServiceBehavior
    Dim servEP As ServiceEndpoint
    
    ' Print the behaviors of the service.
    Console.WriteLine("Behaviors:")
    For c = 0 To servDesc.Behaviors.Count-1
        servBeh = servDesc.Behaviors(c)
        Console.WriteLine(vbTab + "{0}", servBeh)
    Next c
    
    ' Print the endpoint descriptions of the service.
    Console.WriteLine("Endpoints")
    For i = 0 To servDesc.Endpoints.Count-1
        ' Print the endpoint names.
        servEP = servDesc.Endpoints(i)
        Console.WriteLine(vbTab + "Name: {0}", servEP.Name)
        contractDesc = servEP.Contract
        
        Console.WriteLine(vbTab + "Operations:")
        For j = 0 To contractDesc.Operations.Count-1
            ' Print operation names.
            opDesc = servEP.Contract.Operations(j)
            Console.WriteLine(vbTab + vbTab + "{0}", opDesc.Name)
            Console.WriteLine(vbTab + vbTab + "Actions:")
            For k = 0 To opDesc.Messages.Count-1
                ' Print the message action. 
                methDesc = opDesc.Messages(k)
                Console.WriteLine(vbTab + vbTab + vbTab + _
                  "Action:{0}", methDesc.Action)
                
                ' Check for the existence of a body, then the body description.
                mBodyDesc = methDesc.Body
                If mBodyDesc.Parts.Count > 0 Then
                    For l = 0 To methDesc.Body.Parts.Count-1
                        partDesc = methDesc.Body.Parts(l)
                        Console.WriteLine(vbTab + vbTab + _
                        vbTab + vbTab + "{0}", partDesc.Name)
                    Next l
                End If
            Next k
        Next j
    Next i

End Sub

설명

Windows Communication Foundation(WCF) 계약은 엔드포인트가 외부 세계와 통신하는 내용을 지정하는 작업 컬렉션입니다. 각 작업은 메시지 교환입니다. 예를 들어 요청 메시지 및 요청/회신 메시지 교환을 형성하는 연결된 회신 메시지입니다.

ContractDescription 개체는 계약 및 해당 작업을 설명하는 데 사용됩니다. ContractDescription내에서 각 계약 작업에는 작업이 단방향인지 요청/회신인지 여부와 같은 작업의 측면을 설명하는 해당 OperationDescription 작업이 있습니다. 각각 OperationDescription 은 개체 컬렉션을 MessageDescription 사용하여 작업을 구성하는 메시지에 대해서도 설명합니다. ContractDescription 에는 프로그래밍 모델을 사용하여 계약을 정의하는 인터페이스에 대한 참조가 포함되어 있습니다. 이 인터페이스는 로 ServiceContractAttribute표시되고 엔드포인트 작업에 해당하는 메서드는 다음과 같이 OperationContractAttribute표시됩니다.

대부분의 속성 OperationDescription 에는 WCF 프로그래밍 모델의 OperationContractAttribute해당 속성이 있습니다( 예: IsTerminating.).

생성자

OperationDescription(String, ContractDescription)

지정된 이름과 계약 설명을 사용하여 OperationDescription 클래스의 새 인스턴스를 초기화합니다.

속성

BeginMethod

작업의 Begin 메서드를 가져오거나 설정합니다.

Behaviors

작업과 연결된 작업 동작을 가져오거나 설정합니다.

DeclaringContract

작업이 속하는 계약을 가져오거나 설정합니다.

EndMethod

작업의 End 메서드를 가져오거나 설정합니다.

Faults

작업 설명과 연결된 오류 설명을 가져옵니다.

HasProtectionLevel

작업에 보호 수준이 설정되어 있는지 여부를 나타내는 값을 가져옵니다.

IsInitiating

메서드가 서버의 세션(있는 경우)을 시작할 수 있는 작업을 구현할지 여부를 나타내는 값을 가져오거나 설정합니다.

IsOneWay

작업이 회신 메시지를 반환하는지 여부를 나타내는 값을 가져오거나 설정합니다.

IsTerminating

회신 메시지(있는 경우)를 보낸 후 서비스 작업의 결과로 서버에서 세션을 종료할지 여부를 나타내는 값을 가져오거나 설정합니다.

KnownTypes

작업 설명과 연결된 알려진 형식을 가져옵니다.

Messages

작업을 구성하는 메시지에 대한 설명을 가져오거나 설정합니다.

Name

작업 설명의 이름을 가져오거나 설정합니다.

OperationBehaviors

작업에 대한 동작 집합을 가져옵니다.

ProtectionLevel

작업에 대한 보호 수준을 가져오거나 설정합니다.

SyncMethod

작업 설명에 대한 서비스 동기화 메서드를 가져오거나 설정합니다.

TaskMethod

작업에 사용되는 메서드를 가져오거나 설정합니다.

메서드

Equals(Object)

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

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

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

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

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

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

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

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

ProtectionLevel 속성이 기본값에서 변경되었으며 이를 serialize해야 하는지 여부를 나타내는 값을 반환합니다.

ToString()

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

(다음에서 상속됨 Object)

적용 대상