Assembly: System.Xml (in system.xml.dll)
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 SchemaImporterExtension 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 SchemaImporterExtension 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 SchemaImporterExtension 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 SchemaImporterExtension with a command window.
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.