MetadataSection Class

Represents XML metadata or references to XML metadata.

System.Object
  System.ServiceModel.Description.MetadataSection

Namespace:  System.ServiceModel.Description
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public class MetadataSection

The MetadataSection type exposes the following members.

  NameDescription
Public methodMetadataSection()Initializes a new instance of the MetadataSection class with no dialect, identifier, or XML metadata.
Public methodMetadataSection(String, String, Object)Initializes a new instance of the MetadataSection class using the specified dialect, identifier, and XML metadata.
Top

  NameDescription
Public propertyAttributesGets a collection of XML attributes that you can use to add or remove attributes extensions to the metadata.
Public propertyDialectGets or sets a value that indicates the type of metadata.
Public propertyIdentifierGets or sets an identifier for the metadata.
Public propertyMetadataGets or sets the contained metadata object.
Public propertyStatic memberMetadataExchangeDialectContains the value of the metadata exchange dialect.
Public propertyStatic memberPolicyDialectContains the value of the WS-Policy dialect.
Public propertyStatic memberServiceDescriptionDialectContains the value of the Web Services Description Language (WSDL) dialect.
Public propertyStatic memberXmlSchemaDialectContains the value of the XML Schema dialect.
Top

  NameDescription
Public methodStatic memberCreateFromPolicyCreates a MetadataSection from the specified policy information.
Public methodStatic memberCreateFromSchemaCreates a MetadataSection from the specified System.Xml.Schema.XmlSchema object.
Public methodStatic memberCreateFromServiceDescriptionReturns a MetadataSection that contains the specified System.Web.Services.Description.ServiceDescription.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

The MetadataSection class conforms to the definition of the wsx:Metadata/wsx:MetadataSection element in the WS-Metadata Exchange specification and contains XML metadata or references to XML metadata.

A MetadataSection object contains one dialect of metadata in XML form (such as a Web Services Description Language or WSDL file). You can add a MetadataSection to a collection of XML metadata represented by a MetadataSet object. Much of the Windows Communication Foundation (WCF) metadata system, such as the MetadataExchangeClient class, use the MetadataSet class to import or export service metadata in XML form.

For example, to export WCF contract or endpoint objects to a MetadataSet object that contains the equivalent metadata in XML form, call the appropriate Export methods on the WsdlExporter class, passing either ContractDescription or ServiceEndpoint objects, and then call the GetGeneratedMetadata method.

To import XML-based metadata from a MetadataSet object into WCF ContractDescription, ServiceEndpoint, and Binding objects, pass a MetadataSet object to the constructor of the WsdlImporter class and call one of the import methods.

The following code example shows how to retrieve the MetadataSection objects from a System.ServiceModel.Description.MetadataResolver and iterate through them to write the Identifier and Dialect properties to the console.

// Get metadata documents.
Console.WriteLine("URI of the metadata documents retreived:");
MetadataExchangeClient metaTransfer 
  = new MetadataExchangeClient(httpGetMetaAddress.Uri, MetadataExchangeClientMode.HttpGet);
metaTransfer.ResolveMetadataReferences = true;
MetadataSet otherDocs = metaTransfer.GetMetadata();
foreach (MetadataSection doc in otherDocs.MetadataSections)
  Console.WriteLine(doc.Dialect + " : " + doc.Identifier);

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft