By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,905 Members | 1,616 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,905 IT Pros & Developers. It's quick & easy.

serialization inherited objects

P: n/a
Hi,

I have some questions that are a little difficult to explain, so I give it a
try...

I have an application (aSP.NET with VB.NET codebehind) and I would like to
store my data on disk because the users could continue later on there
project with the same data already filled in.
So I would use the soap-serialization to store the info (the nested objects,
collections, ...). I think this process will work very well, also the
deserialization. But now the problems. It's almost certain that my app will
change a little bit within a few months. Some extra propertys in the objects
and so on. But it seeems that this will give problems with the
deserialization. Because older projects - that doesn't have the new
properties - must also keep worrking (loading in the data). And now I have
tested this with an simple class that has 3 properties. Serialized an
object. Then changed the classdefinition to 4 propertys and I received and
error.

Now I would like some solution will the serialization keeps working. So I
thaught of inheritance.
The problem is, that in my app I would like to keep using my original name
for the objects. Say The class is "Person". In my app I have several
dim-statements "as Person". When I make an new object "Person1" that
inherits form "Person", I have to change my statements to. Also how does the
serialization works then. I have an older "person"-object, so I can't use
the deserialization of "Person1". When i load in the data I would have to
check by some way which kind of object was stored (is this possible), to
call even the correct deserialization method...

Hmm, not easy to explain the problem. What I would like to do: is it
possible to use older serialized data in an application after the definition
of the objects (nested objects) are changed. Can i simply desrialize the old
data? And can this be done with the same "method/procedure" as when i
deserialize data that is already in the correct (latest) version. And how to
solve the problem when the new version has to change again, to version 2...

I have seen some info about "versioning" and serialization, but It isn't
very clear to me right know. Maybe someone that has some clear
examples/info. Maybe something like my problem.

Hopefully somebody can help me with this 'little' problem

Thx very muh

Frederik
Nov 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.