Making Sense with Data Contract (Structural Contract)

One of the confusing aspects of learning data contract is that WCF offering multiple approaches to define data contract.  For beginners, DataContractAttribute is the most common approach to specify request and response messages, which in turn use serialization for data transfer.  DataContractAttribute earns the most emphasis and is rightly so because it’s designed for WCF.  So, mastering DataContractAttribute is essential.

Yet DataContractAttribute is not a one size fit all solution.  Other approaches make sense for different purpose.  So as you dig deeper, learn the benefit and trade off in each approach.

Here’re approaches WCF offering for data transfer.  I ranked in terms of most-likely-to-use to least-likely-to-use.

  1. DataContractAttribute is designed for WCF serialization to handle user-defined types.  Using DataContractAttribute is the preferred approach.  For more information, please see The Anatomy of DataContractAttribute
  2. Pre-existing serialization mechanism is also applicable to WCF.  These include types having SerializableAttribute and IXmlSerializable
  3. MessageContractAttributes offers better degree of control over SOAP message structure definition.  For more information, please see The Anatomy of MessageContractAttribute
  4. Message class allows complete control over SOAP message specification.  For more information, please see Using the Message Class
  5. Stream class allows large message processing.  For more information, please see Large Data and Streaming

Further Study

Data Transfer and Serialization

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Comments are closed.