Click to Rate and Give Feedback
MSDN
MSDN Library
SQL Server
SQL Server 2008
Database Engine
Development
Developer's Guide
 XML Serialization from CLR Database...
Other versions are also available for the following:
SQL Server 2008 Books Online
XML Serialization from CLR Database Objects

XML serialization is required for two scenarios:

  • Invoking Web Services from common language runtime (CLR) objects.
  • Converting a user-defined type (UDT) to XML.

Performing XML serialization by invoking the XmlSerializer class normally generates an additional serialization assembly that is overloaded into the project with the source assembly. However, for security purposes, this overload is disabled in the CLR. Therefore, to call a web service or perform conversion from UDT to XML inside SQL Server, the assembly must be created manually using a tool called Sgen.exe provided with the .NET Framework that generates the necessary serialization assemblies. When invoking XmlSerializer, the serialization assembly must be created manually by following these steps:

  1. Run the Sgen.exe tool that is provided with the .NET Framework SDK to create the assembly containing the XML serializers for the source assembly.
  2. Register the generated assembly in SQL Server using the CREATE ASSEMBLY statement.

For information about errors that you may receive when performing XML serialization, see the following Microsoft Support article: "Cannot load dynamically generated serialization assembly".

For information on data types that are not supported by XMLSerializer, see XML Schema Binding Support in the .NET Framework in the .NET Framework documentation.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker