Understanding Data Contracts

Data contracts, in WCF, are the preferred method of abstracting your .NET types from the schema and XML serialized types. With WCF, you have choices for creating the metadata that is used to publish your service and how that impacts the runtime serialization of your .NET types into platform-agnostic schema types that are represented in XML.

The process is all hidden, if you choose, from the developer. Primitive types are easily mapped to leverage the default DataContractSerializer. Other types are controllable through the DataContract attribute capabilities. However, if you still want control, you can always leverage XmlSerializer to manage the serialization of your types into XML. So, in the following sections, ...

Get Pro WCF: Practical Microsoft SOA Implementation now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.