Home > Uncategorized > WCF DataContract versionning issue

WCF DataContract versionning issue

I get recently face to a problem during my development work of an application around WCF service. The problem I face was about different version in place of WCF contracts.

This happen during my development phase because I get different test environment but this is something you might be face in an improvement phase of an existing deployed services.


Scenario :

You have prepared a fully functional object that will be used in your DataContract.

Let call that object “Contact” which contain a single member “FirstName” and “LastName”


This object is then consumed by a client application which is then deployed at your customer site.


In a normal evolution of software we usually add functionalities. What happen then if from our object “Contact”

we create a second version of it with more members ?


The effect will be that your new member will be set to its default value of 0 when deserialized at the Client. This is absolutely not what we want.


Solution :

implement the IExtensibleDataObject interface, you must implement the ExtensionData property. The property holds data from future versions of the class for backward compatibility.



    Name = “Contact”,

    Namespace = http://yourcomapny.com/Contacts”)]

class Contact :IExtensibleDataObject


 private ExtensionDataObject extensionDataObject_value;

    public ExtensionDataObject ExtensionData




            return extensionDataObject_value;




            extensionDataObject_value = value;




    public string FirsName;



    public string LastName;




For more details, a nice example describes the situation at :


Categories: Uncategorized Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: