Data Representation


Data being sent from a Windows Communication Foundation client to a service is serialized to XML within the client, and data received from clients by Windows Communication Foundation services is deserialized from XML within the service. There are two XML serializers that the Windows Communication Foundation can use to accomplish the serialization to XML and deserialization from XML. One is the XmlSerializer class that has been a part of the .NET Framework class library from the outset. The other is the XmlFormatter class that is new with the Windows Communication Foundation. Whereas the XmlSerializer provides precise control over how data is represented as XML, the XmlFormatter provides very little control over that in order to make the serialization process very predictable, and, thereby, easier to optimize. As a result, the XmlFormatter outperforms the XmlSerializer.

Allowing the XmlFormatter to serialize one's custom types is very simple. One merely adds a DataContract attribute to the definition of the type, and DataMember attributes to each of the type's members that are to be serialized.

Implementing the IUnknownSerializationData interface in any type that is to be serialized using the XmlFormatter is wise. It allows for different versions of the same way of representing the data in XML to evolve independently of one another, yet still be usable together.

 Python   SQL   Java   php   Perl 
 game development   web development   internet   *nix   graphics   hardware 
 telecommunications   C++ 
 Flash   Active Directory   Windows