Allows you to customize the code generated from a Web Services Description Language (WSDL) document when using automated query tools.
Assembly: System.Xml (in System.Xml.dll)
Thetype exposes the following members.
|Equals(Object)||Determines whether the specified object is equal to the current object. (Inherited from Object.)|
|GetHashCode||Serves as the default hash function. (Inherited from Object.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|ImportAnyElement||Handles the importation of the <xsd:any> elements in the schema.|
|ImportDefaultValue||Allows you to specify the default value for the XSD type being imported.|
|ImportSchemaType(XmlSchemaType, XmlSchemaObject, XmlSchemas, XmlSchemaImporter, CodeCompileUnit, CodeNamespace, CodeGenerationOptions, CodeDomProvider)||Allows you to manipulate the code generated by examining the imported schema and specifying the CLR type that it maps to.|
|ImportSchemaType(String, String, XmlSchemaObject, XmlSchemas, XmlSchemaImporter, CodeCompileUnit, CodeNamespace, CodeGenerationOptions, CodeDomProvider)||Allows you to manipulate the code generated by examining the imported schema and specifying the CLR type that it maps to.|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
Schema importation occurs whenever a Web service proxy is produced through a tool such as the Add Web Reference dialog box found in Visual Studio, or by using the Web Services Description Language Tool (Wsdl.exe). Schema importation also occurs when using the XML Schema Definition Tool (Xsd.exe) to generate code from a specific XSD document.
The class allows you to modify the code generated when using any of these tools. For example, you may have an existing class that processes book orders on a system and you have an existing XSD document that supplies your orders. Using the class, you can enable one of the tools to generate code that uses your class.
The steps to enabling the WSDL.exe tool (which in turn is used by other tools such as the Add Web Reference dialog box) to use your extension are:
Create an implementation of the class.
Use the ImportSchemaType method to write code for the code generator. The method contains parameters that allow you to examine the intercepted XSD type and create CodeDOM objects that are used to generate the new CLR code.
If required, use the ImportAnyElement method to handle <xsd:any> elements found in the XSD document.
If required, use the ImportDefaultValue method to examine default values found in the XSD document and return a different default value.
Compile your extension into a library.
Sign the assembly.
Install the assembly in the Global Assembly Cache (GAC).
Modify the machine.config file to include the extension.
See the SchemaImporterExtension Technology Sample. Note that this example does not include a signed assembly. Instead, it demonstrates how to use the with a command window.