Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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 31-Jan-13 1:44am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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[^]
  Permalink  

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

  Print Answers RSS
0 /\jmot 230
1 Zoltán Zörgő 210
2 CHill60 145
3 Peter Leow 145
4 Sergey Alexandrovich Kryukov 115
0 Sergey Alexandrovich Kryukov 9,353
1 OriginalGriff 6,881
2 Peter Leow 4,577
3 Zoltán Zörgő 4,129
4 Richard MacCutchan 2,882


Advertise | Privacy | Mobile
Web02 | 2.8.150129.1 | Last Updated 31 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100