Export (0) Print
Expand All

XmlSerializerAssemblyAttribute Class

Applied to a Web service client proxy, enables you to specify an assembly that contains custom-made serializers.

Namespace: System.Xml.Serialization
Assembly: System.Xml (in system.xml.dll)

[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Interface, AllowMultiple=false)] 
public sealed class XmlSerializerAssemblyAttribute : Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Interface, AllowMultiple=false) */ 
public final class XmlSerializerAssemblyAttribute extends Attribute
AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Interface, AllowMultiple=false) 
public final class XmlSerializerAssemblyAttribute extends Attribute
Not applicable.

Use the XmlSerializerAssemblyAttribute to increase the performance of a Web service client application.

A typical method of using this attribute is as follows:

  1. Create a client proxy for a Web service.

  2. Open the machine.config file.

  3. Under the system.diagnostics element, add a value under the <switches> element to keep the compiled files:

    <system.diagnostics>
       <switches>
          <add name="XmlSerialization.Compilation" value="4"/>
       </switches>
    </system.diagnostics>
    
  4. Compile the proxy.

  5. Run the proxy application.

  6. Open a command window and navigate to the \Temp directory used by the XmlSerializer to cache files.

    cd %temp%
    
  7. Find the last file created using the dir command with the /OD switch.

    dir *.vb /OD 
    
  8. Compile the file into an assembly. Name the assembly.

  9. Edit the original proxy code by applying the XmlSerializerAssemblyAttribute to the class. Specify the assembly name, as shown in the following C# code.

    [XmlSerializerAssemblyAttribute(AssemblyName="hello.serializer")]
    public class Hello: System.Web.Services.Protocols.SoapHttpClientProtocol {
       // Proxy code not shown.
    }
    
<XmlSerializerAssemblyAttribute(AssemblyName:="hello.serializer")> _
Public Class Hello
Implements System.Web.Services.Protocols.SoapHttpClientProtocol 
   ' Proxy code not shown.
End Class

System.Object
   System.Attribute
    System.Xml.Serialization.XmlSerializerAssemblyAttribute

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 98, Windows Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft