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 OriginalGriff 584
1 Maciej Los 275
2 DamithSL 233
3 Sergey Alexandrovich Kryukov 209
4 BillWoodruff 200
0 OriginalGriff 6,803
1 Sergey Alexandrovich Kryukov 6,377
2 DamithSL 5,421
3 Manas Bhardwaj 4,841
4 Maciej Los 4,330


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 31 Jan 2013
Copyright © CodeProject, 1999-2014
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