Sunday, November 07, 2010

Versioning in WCF Data Contract Part #1: Adding New Members

DataContract versioning requires when some modification has been done to the existing DataContract exposed to the client from the service or vice versa. If either service or client is changing the schema of DataContract exposed then new version of DataContract come into action and both party involved in communication should be able to accommodate the changes done in the DataContract.
The scenario causes for new version of DataContract is as below,
Missing a member from existing DataContract .
Adding a new member to existing DataContract.
Round Tripping
In this article we will explore New Member scenarios
Adding a New Member to existing DataContract
This is most common changes we do to give new version to DataContract.
For example we have a DataContract through which we are exposing Product custom class to the client
   [DataMember(Order = 1)]
   [DataMember(Order = 2)]
   [DataMember(Order = 3)]
Read more: Beyond Relational