MetadataSection MetadataSection MetadataSection MetadataSection Class

Definition

Represents XML metadata or references to XML metadata.

public ref class MetadataSection
public class MetadataSection
type MetadataSection = class
Public Class MetadataSection
Inheritance
MetadataSectionMetadataSectionMetadataSectionMetadataSection

Examples

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);

Remarks

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 WCFContractDescription, ServiceEndpoint, and Binding objects, pass a MetadataSet object to the constructor of the WsdlImporter class and call one of the import methods.

Constructors

MetadataSection() MetadataSection() MetadataSection() MetadataSection()

Initializes a new instance of the MetadataSection class with no dialect, identifier, or XML metadata.

MetadataSection(String, String, Object) MetadataSection(String, String, Object) MetadataSection(String, String, Object) MetadataSection(String, String, Object)

Initializes a new instance of the MetadataSection class using the specified dialect, identifier, and XML metadata.

Properties

Attributes Attributes Attributes Attributes

Gets a collection of XML attributes that you can use to add or remove attributes extensions to the metadata.

Dialect Dialect Dialect Dialect

Gets or sets a value that indicates the type of metadata.

Identifier Identifier Identifier Identifier

Gets or sets an identifier for the metadata.

Metadata Metadata Metadata Metadata

Gets or sets the contained metadata object.

MetadataExchangeDialect MetadataExchangeDialect MetadataExchangeDialect MetadataExchangeDialect

Contains the value of the metadata exchange dialect.

PolicyDialect PolicyDialect PolicyDialect PolicyDialect

Contains the value of the WS-Policy dialect.

ServiceDescriptionDialect ServiceDescriptionDialect ServiceDescriptionDialect ServiceDescriptionDialect

Contains the value of the Web Services Description Language (WSDL) dialect.

XmlSchemaDialect XmlSchemaDialect XmlSchemaDialect XmlSchemaDialect

Contains the value of the XML Schema dialect.

Methods

CreateFromPolicy(XmlElement, String) CreateFromPolicy(XmlElement, String) CreateFromPolicy(XmlElement, String) CreateFromPolicy(XmlElement, String)

Creates a MetadataSection from the specified policy information.

CreateFromSchema(XmlSchema) CreateFromSchema(XmlSchema) CreateFromSchema(XmlSchema) CreateFromSchema(XmlSchema)

Creates a MetadataSection from the specified XmlSchema object.

CreateFromServiceDescription(ServiceDescription) CreateFromServiceDescription(ServiceDescription) CreateFromServiceDescription(ServiceDescription) CreateFromServiceDescription(ServiceDescription)

Returns a MetadataSection that contains the specified ServiceDescription.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to