WsdlContractConversionContext 클래스

정의

계약에 대한 메타데이터 내보내기 및 가져오기를 사용자 지정할 수 있도록 사용자 지정 WSDL 내보내기 및 가져오기에 전달됩니다.

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

예제

다음 코드 예제에서는 WsdlContractConversionContextWsdlPortType 속성을 사용하여 내보낸 메타데이터에 Contract를 사용하여 사용자 지정 WSDL 주석을 추가하는 방법을 보여 줍니다.

public void ExportContract(WsdlExporter exporter, WsdlContractConversionContext context)
{
Console.WriteLine("Inside ExportContract");
if (context.Contract != null)
{
    // Inside this block it is the contract-level comment attribute.
    // This.Text returns the string for the contract attribute.
    // Set the doc element; if this isn't done first, there is no XmlElement in the
    // DocumentElement property.
    context.WsdlPortType.Documentation = string.Empty;
    // Contract comments.
    XmlDocument owner = context.WsdlPortType.DocumentationElement.OwnerDocument;
    XmlElement summaryElement = Formatter.CreateSummaryElement(owner, this.Text);
    context.WsdlPortType.DocumentationElement.AppendChild(summaryElement);

    foreach (OperationDescription op in context.Contract.Operations)
    {
        Operation operation = context.GetOperation(op);
        object[] opAttrs = op.SyncMethod.GetCustomAttributes(typeof(WsdlDocumentationAttribute), false);
        if (opAttrs.Length == 1)
        {
            string opComment = ((WsdlDocumentationAttribute)opAttrs[0]).Text;

            // This.Text returns the string for the operation-level attributes.
            // Set the doc element; if this isn't done first, there is no XmlElement in the
            // DocumentElement property.
            operation.Documentation = String.Empty;

            // Operation C# triple comments.
            XmlDocument opOwner = operation.DocumentationElement.OwnerDocument;
            XmlElement newSummaryElement = Formatter.CreateSummaryElement(opOwner, opComment);
            operation.DocumentationElement.AppendChild(newSummaryElement);

            // Get returns information
            ParameterInfo returnValue = op.SyncMethod.ReturnParameter;
            object[] returnAttrs = returnValue.GetCustomAttributes(typeof(WsdlParameterDocumentationAttribute), false);
            if (returnAttrs.Length == 1)
            {
                // <returns>text.</returns>
                XmlElement returnsElement =
                  Formatter.CreateReturnsElement(
                    opOwner,
                    ((WsdlParameterDocumentationAttribute)returnAttrs[0]).ParamComment
                  );
                operation.DocumentationElement.AppendChild(returnsElement);
            }

            // Get parameter information.
            ParameterInfo[] args = op.SyncMethod.GetParameters();
            for (int i = 0; i < args.Length; i++)
            {
                object[] docAttrs
                  = args[i].GetCustomAttributes(typeof(WsdlParameterDocumentationAttribute), false);
                if (docAttrs.Length != 0)
                {
                    // <param name="Int1">Text.</param>
                    XmlElement newParamElement = opOwner.CreateElement("param");
                    XmlAttribute paramName = opOwner.CreateAttribute("name");
                    paramName.Value = args[i].Name;
                    newParamElement.InnerText
                      = ((WsdlParameterDocumentationAttribute)docAttrs[0]).ParamComment;
                    newParamElement.Attributes.Append(paramName);
                    operation.DocumentationElement.AppendChild(newParamElement);
                }
            }
        }
    }
}

설명

WSDL에서 변환할 항목을 검사하고 수정하려면 WsdlContractConversionContext 개체를 사용합니다.

WsdlContractConversionContext 개체는 메타데이터를 내보낼 때 ExportContractExportEndpoint 메서드에 전달됩니다. 다양한 메서드와 속성을 사용하여 게시된 WSDL을 검사하고 수정하는 데 사용할 수 있는 메타데이터 개체를 가져올 수 있습니다.

WsdlContractConversionContext 개체는 메타데이터를 가져올 때 ImportContractImportEndpoint 메서드에 전달됩니다. 다양한 메서드와 속성을 사용하여, 가져온 WSDL을 검사하고 수정하는 데 사용할 수 있는 메타데이터 개체를 가져올 수 있습니다.

속성

Contract

내보내거나 가져오려는 ContractDescription를 가져옵니다.

WsdlPortType

계약을 나타내는 PortType을 가져옵니다.

메서드

Equals(Object)

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

(다음에서 상속됨 Object)
GetFaultDescription(OperationFault)

지정한 오류에 대한 오류 설명을 반환합니다.

GetHashCode()

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

(다음에서 상속됨 Object)
GetMessageDescription(OperationMessage)

지정한 메시지에 대한 메시지 설명을 반환합니다.

GetOperation(OperationDescription)

지정한 작업 설명에 대한 작업을 반환합니다.

GetOperationDescription(Operation)

작업과 연결된 작업 설명을 반환합니다.

GetOperationFault(FaultDescription)

요청된 OperationFault에 대한 FaultDescription를 반환합니다.

GetOperationMessage(MessageDescription)

지정한 OperationMessage에 대해 XML Web Services 작업에서 전달한 메시지 형식을 나타내는 message 개체를 가져옵니다.

GetType()

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

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

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

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

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

(다음에서 상속됨 Object)

적용 대상