Pro WCF: Practical Microsoft SOA Implementation
by Chris Peiris, Dennis Mulder, Shawn Cicoria, Amit Bahree, Nishith Pathak
Introducing Data Contracts
Data contracts are the "agreement" between a service and its consumer. At an abstract level, the contract defines how the data will be exchanged between the two and also defines what data is returned for each type (that is, serialized to XML). For a service and its consumer to communicate, they do not necessarily have to share the same types; they need to share only the data contracts. The default serialize engine in WCF is the data contract serializer, which is implemented as the DataContractSerializer class and is the recommended way to go for WCF. All .NET primitive types can be serialized without any other requirement. However, new complex types need to have an associated data contract defined before they can be ...
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