다음을 통해 공유


WsdlExporter.GetGeneratedMetadata 메서드

정의

생성된 MetadataSection 개체의 열거 가능한 컬렉션을 반환합니다.

public:
 override System::ServiceModel::Description::MetadataSet ^ GetGeneratedMetadata();
public override System.ServiceModel.Description.MetadataSet GetGeneratedMetadata ();
override this.GetGeneratedMetadata : unit -> System.ServiceModel.Description.MetadataSet
Public Overrides Function GetGeneratedMetadata () As MetadataSet

반환

MetadataSet

생성된 MetadataSection 개체의 열거 가능한 컬렉션으로, ExportContract(ContractDescription), ExportEndpoint(ServiceEndpoint) 또는 ExportEndpoints(IEnumerable<ServiceEndpoint>, XmlQualifiedName)에 대한 호출의 결과로 생성된 메타데이터를 나타냅니다.

예제

다음 코드 예제에서는 ExportEndpoint 메서드를 사용하여 MetadataSection라는 ServiceEndpoint 개체 컬렉션의 엔드포인트에서 myServiceEndpoints 개체를 생성하는 방법을 보여 줍니다.

using System;
using System.ServiceModel;
using System.ServiceModel.Description;

namespace WsdlExporterSample
{
    class Program
    {
        static void Main(string[] args)
        {
            WsdlExporter exporter = new WsdlExporter();
            exporter.PolicyVersion = PolicyVersion.Policy15;

            ServiceEndpoint [] myServiceEndpoints = new ServiceEndpoint[2];
            ContractDescription myDescription = new ContractDescription ("myContract");
            myServiceEndpoints[0] = new ServiceEndpoint(myDescription,new BasicHttpBinding(),new EndpointAddress("http://localhost/myservice"));
            myServiceEndpoints[1] = new ServiceEndpoint(myDescription,new BasicHttpBinding(),new EndpointAddress("http://localhost/myservice"));

            // Export all endpoints for each endpoint in collection.
            foreach (ServiceEndpoint endpoint in myServiceEndpoints)
            {
                exporter.ExportEndpoint(endpoint);
            }
            // If there are no errors, get the documents.
            MetadataSet metadataDocs = null;
            if (exporter.Errors.Count != 0)
            {
                metadataDocs = exporter.GetGeneratedMetadata();
            }
        }
    }
}
Imports System.ServiceModel
Imports System.ServiceModel.Description

Module Module1

    Sub Main()
        Dim exporter As New WsdlExporter()
        exporter.PolicyVersion = PolicyVersion.Policy15

        Dim myServiceEndpoints() As ServiceEndpoint = New ServiceEndpoint(1) {}
        Dim myDescription As New ContractDescription("myContract")
        myServiceEndpoints(0) = New ServiceEndpoint(myDescription, New BasicHttpBinding(), New EndpointAddress("http://localhost/myservice"))
        myServiceEndpoints(1) = New ServiceEndpoint(myDescription, New BasicHttpBinding(), New EndpointAddress("http://localhost/myservice"))

        'Export all endpoints for each endpoint in collection.
        For Each endpoint As ServiceEndpoint In myServiceEndpoints
            exporter.ExportEndpoint(endpoint)
        Next

        'If there are no errors, get the documents.
        Dim metadataDocs As MetadataSet
        metadataDocs = Nothing

        If (exporter.Errors.Count = 0) Then
            metadataDocs = exporter.GetGeneratedMetadata()
        End If
    End Sub

End Module

설명

GetGeneratedMetadata, ExportContract 또는 ExportEndpoint에 대한 모든 호출의 결과로 생성된 모든 메타데이터 컬렉션을 가져오려면 ExportEndpoints 속성을 사용합니다.

메타데이터를 검색하기 전에 기본 Errors 속성을 검사하여 오류가 발생했는지 여부를 확인하는 것이 좋습니다.

적용 대상