I recently wrote an article on the various serialization options in WCF (which will soon be published in
MSDN Magazine). It focuses on the differences between XmlSerializer, DataContractSerializer (DCS), and NetDataContractSerializer, their programming models, tool support, and when to use one vs. the other.
While the WCF team was reviewing my piece,
Sowmy (a serialization dev) pointed me to
a blog entry he wrote on the DCS rules. It's amazingly succinct as Don
pointed out. The piece documents the supported framework types and the precedence rules if a type implements more than one DCS programming model. For example, if a type implements both IXmlSerializable and ISerializable, the former is used.
However, the main question the rules raised in my mind was what happens when a type uses [DataContract] and implements IXmlSerializable at the same time. The rules imply that the [DataContract] mapping would be used, while it is seems more logical (to me at least) for IXmlSerializable to kick in. In discussing with Sowmy, it sounds like these "dual projection" scenarios are disallowed in v1 (they throw an exception when found).
Burn
these rules into your brain. I'll let you know once my article hits the Web-waves.
Posted
May 13 2006, 03:00 PM
by
Aaron Skonnard