Pro WCF: Practical Microsoft SOA Implementation
by Chris Peiris, Dennis Mulder, Shawn Cicoria, Amit Bahree, Nishith Pathak
XML Serialization
As you have seen so far, the default option to serialize data types is the data contract serializer, which is implemented via the DataContractSerializer class. However, WCF also supports XmlSerializer. Although XmlSerializer supports fewer types compared to DataContractSerializer, it does provide better control over the resulting XML and also supports more of the XSD standard. Even though DataContractSerializer is the default option, sometimes using XmlSerializer is better:
It's better if you are migrating an application from ASP.NET web services to WCF and want to reuse existing types instead of data contracts.
It's better when more control over XML is required for it to adhere to some schema.
It's better when services need ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access