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

 

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

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

public:
WsdlImporter(
	MetadataSet^ metadata,
	IEnumerable<IPolicyImportExtension^>^ policyImportExtensions,
	IEnumerable<IWsdlImportExtension^>^ wsdlImportExtensions
)

Parameters

metadata
Type: System.ServiceModel.Description::MetadataSet^

The downloaded metadata.

policyImportExtensions
Type: System.Collections.Generic::IEnumerable<IPolicyImportExtension^>^

The custom policy importers used to import custom policy statements.

wsdlImportExtensions
Type: System.Collections.Generic::IEnumerable<IWsdlImportExtension^>^

The custom WSDL importers used to import custom WSDL elements.

Exception Condition
ArgumentNullException

The metadata argument is null.

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

System_CAPS_noteNote

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.

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

.NET Framework
Available since 3.0
Return to top
Show: