Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

SchemaImporterExtension Class

Allows you to customize the code generated from a Web Services Description Language (WSDL) document when using automated query tools.

Namespace:  System.Xml.Serialization.Advanced
Assembly:  System.Xml (in System.Xml.dll)
public abstract class SchemaImporterExtension

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.

In order to control the generation of the code, you must use the classes found in the System.CodeDom namespace. For more information, see Using the CodeDOM and CodeDOM Quick Reference.

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:

  1. Create an implementation of the SchemaImporterExtension class.

  2. 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.

  3. If required, use the ImportAnyElement method to handle <xsd:any> elements found in the XSD document.

  4. If required, use the ImportDefaultValue method to examine default values found in the XSD document and return a different default value.

  5. Compile your extension into a library.

  6. Sign the assembly.

  7. Install the assembly in the Global Assembly Cache (GAC).

  8. 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.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.