Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I'm implementing a project where I have a complex state object which needs to be stored away and at a later date consumed by a number of different services.

The nature of this state object is that it is going to evolve where additional properties are added to the object.

My concern is that older versions of the object are going to fail the deserialization process with each evolution of the object.

I've looked into the use of custom serialization using ISerializable and also aiding the default serialization process by applying the NonSerialized attribute to any new properties.

What I'm hope for is some feedback from developers who've previously faced this type of issue and if they point out some pit falls or problems with either the ISerializable or NonSerialized approach, or perhaps recommend a third approach I haven't yet contemplated?
Posted

1 solution

In asking my question I found the right terminology to find the answer in google.

From .Net 2.0 onwards the framework has supported "Version Tolerant Serialization".

This provides a number of tools for managing serialisation and deserialisation of object of different versions.

These includes attributes such as OptionalField, OnDeserializing, OnDeserialized, OnSerializing and OnSerialized.

http://msdn.microsoft.com/en-us/library/ms229752(v=vs.100).aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900