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 ...

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.