Editar

Partilhar via


WsdlImporter Constructors

Definition

Initializes a new instance of the WsdlImporter class.

Overloads

WsdlImporter(MetadataSet)

Initializes a new instance of the WsdlImporter class.

WsdlImporter(MetadataSet, IEnumerable<IPolicyImportExtension>, IEnumerable<IWsdlImportExtension>)

Creates a WsdlImporter object from the specified metadata, custom policy importers, and custom WSDL importers.

WsdlImporter(MetadataSet, IEnumerable<IPolicyImportExtension>, IEnumerable<IWsdlImportExtension>, MetadataImporterQuotas)

Creates a WsdlImporter object from the specified metadata, custom policy importers, and custom WSDL importers.

WsdlImporter(MetadataSet)

Initializes a new instance of the WsdlImporter class.

public:
 WsdlImporter(System::ServiceModel::Description::MetadataSet ^ metadata);
public WsdlImporter (System.ServiceModel.Description.MetadataSet metadata);
new System.ServiceModel.Description.WsdlImporter : System.ServiceModel.Description.MetadataSet -> System.ServiceModel.Description.WsdlImporter
Public Sub New (metadata As MetadataSet)

Parameters

metadata
MetadataSet

A collection of metadata documents from which to extract contract, endpoint, and binding information.

Examples

The following code example shows the most common use of WsdlImporter class with the MetadataResolver class.

MetadataExchangeClient mexClient = new MetadataExchangeClient(metadataAddress);
mexClient.ResolveMetadataReferences = true;
MetadataSet metaDocs = mexClient.GetMetadata();

      WsdlImporter importer = new WsdlImporter(metaDocs);
ServiceContractGenerator generator = new ServiceContractGenerator();

Remarks

Use the WsdlImporter constructor to create a WsdlImporter object from a set of metadata documents.

Applies to

WsdlImporter(MetadataSet, IEnumerable<IPolicyImportExtension>, IEnumerable<IWsdlImportExtension>)

Creates a WsdlImporter object from the specified metadata, custom policy importers, and custom WSDL importers.

public:
 WsdlImporter(System::ServiceModel::Description::MetadataSet ^ metadata, System::Collections::Generic::IEnumerable<System::ServiceModel::Description::IPolicyImportExtension ^> ^ policyImportExtensions, System::Collections::Generic::IEnumerable<System::ServiceModel::Description::IWsdlImportExtension ^> ^ wsdlImportExtensions);
public WsdlImporter (System.ServiceModel.Description.MetadataSet metadata, System.Collections.Generic.IEnumerable<System.ServiceModel.Description.IPolicyImportExtension> policyImportExtensions, System.Collections.Generic.IEnumerable<System.ServiceModel.Description.IWsdlImportExtension> wsdlImportExtensions);
new System.ServiceModel.Description.WsdlImporter : System.ServiceModel.Description.MetadataSet * seq<System.ServiceModel.Description.IPolicyImportExtension> * seq<System.ServiceModel.Description.IWsdlImportExtension> -> System.ServiceModel.Description.WsdlImporter
Public Sub New (metadata As MetadataSet, policyImportExtensions As IEnumerable(Of IPolicyImportExtension), wsdlImportExtensions As IEnumerable(Of IWsdlImportExtension))

Parameters

metadata
MetadataSet

The downloaded metadata.

policyImportExtensions
IEnumerable<IPolicyImportExtension>

The custom policy importers used to import custom policy statements.

wsdlImportExtensions
IEnumerable<IWsdlImportExtension>

The custom WSDL importers used to import custom WSDL elements.

Exceptions

The metadata argument is null.

Examples

The following code example shows how to add a new custom WSDL importer (the WSDLDocumentationImporter) to the default set of importers prior to using the WsdlImporter object.

// The following code inserts a custom WsdlImporter without removing the other
// importers already in the collection.
System.Collections.Generic.IEnumerable<IWsdlImportExtension> exts = importer.WsdlImportExtensions;
System.Collections.Generic.List<IWsdlImportExtension> newExts
  = new System.Collections.Generic.List<IWsdlImportExtension>();
foreach (IWsdlImportExtension ext in exts)
{
  Console.WriteLine("Default WSDL import extensions: {0}", ext.GetType().Name);
  newExts.Add(ext);
}
newExts.Add(new WsdlDocumentationImporter());
System.Collections.Generic.IEnumerable<IPolicyImportExtension> polExts = importer.PolicyImportExtensions;
importer = new WsdlImporter(metaDocs, polExts, newExts);

Remarks

Use this constructor to control the metadata to be imported and the policy and WSDL importers to be used.

Note

If custom policy importers or custom WSDL importers are passed to this constructor any custom importers specified in application configuration files are not loaded. If you want to add a custom importer, you must reconstruct the importers collections prior to using this constructor. See the Example section.

Applies to

WsdlImporter(MetadataSet, IEnumerable<IPolicyImportExtension>, IEnumerable<IWsdlImportExtension>, MetadataImporterQuotas)

Creates a WsdlImporter object from the specified metadata, custom policy importers, and custom WSDL importers.

public:
 WsdlImporter(System::ServiceModel::Description::MetadataSet ^ metadata, System::Collections::Generic::IEnumerable<System::ServiceModel::Description::IPolicyImportExtension ^> ^ policyImportExtensions, System::Collections::Generic::IEnumerable<System::ServiceModel::Description::IWsdlImportExtension ^> ^ wsdlImportExtensions, System::ServiceModel::Description::MetadataImporterQuotas ^ quotas);
public WsdlImporter (System.ServiceModel.Description.MetadataSet metadata, System.Collections.Generic.IEnumerable<System.ServiceModel.Description.IPolicyImportExtension> policyImportExtensions, System.Collections.Generic.IEnumerable<System.ServiceModel.Description.IWsdlImportExtension> wsdlImportExtensions, System.ServiceModel.Description.MetadataImporterQuotas quotas);
new System.ServiceModel.Description.WsdlImporter : System.ServiceModel.Description.MetadataSet * seq<System.ServiceModel.Description.IPolicyImportExtension> * seq<System.ServiceModel.Description.IWsdlImportExtension> * System.ServiceModel.Description.MetadataImporterQuotas -> System.ServiceModel.Description.WsdlImporter
Public Sub New (metadata As MetadataSet, policyImportExtensions As IEnumerable(Of IPolicyImportExtension), wsdlImportExtensions As IEnumerable(Of IWsdlImportExtension), quotas As MetadataImporterQuotas)

Parameters

metadata
MetadataSet

The downloaded metadata.

policyImportExtensions
IEnumerable<IPolicyImportExtension>

The custom policy importers used to import custom policy statements.

wsdlImportExtensions
IEnumerable<IWsdlImportExtension>

The custom WSDL importers used to import custom WSDL elements.

quotas
MetadataImporterQuotas

The amount of metadata to retrieve at a time.

Exceptions

The metadata argument is null.

Examples

The following code example shows how to add a new custom WSDL importer (the WSDLDocumentationImporter) to the default set of importers prior to using the WsdlImporter object.

// The following code inserts a custom WsdlImporter without removing the other
// importers already in the collection.
System.Collections.Generic.IEnumerable<IWsdlImportExtension> exts = importer.WsdlImportExtensions;
System.Collections.Generic.List<IWsdlImportExtension> newExts
  = new System.Collections.Generic.List<IWsdlImportExtension>();
foreach (IWsdlImportExtension ext in exts)
{
  Console.WriteLine("Default WSDL import extensions: {0}", ext.GetType().Name);
  newExts.Add(ext);
}
newExts.Add(new WsdlDocumentationImporter());
System.Collections.Generic.IEnumerable<IPolicyImportExtension> polExts = importer.PolicyImportExtensions;
importer = new WsdlImporter(metaDocs, polExts, newExts);

Remarks

Use this constructor to control the metadata to be imported and the policy and WSDL importers to be used.

Note

If custom policy importers or custom WSDL importers are passed to this constructor any custom importers specified in application configuration files are not loaded. If you want to add a custom importer, you must reconstruct the importers collections prior to using this constructor. See the Example section.

Applies to