serialization inherited objects

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Goethals Frederik (ivpv_remove_me_at_remove_me_belgacom.net)
Date: 06/30/04


Date: Wed, 30 Jun 2004 16:43:28 +0200

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



Relevant Pages

  • Re: cannot use static fields in AJAX applications?
    ... type's assembly is sufficient to resolve additional types. ... serializer construction for specific types. ... ViewState's built-in serialization does not like dynamically constructed ... serializers for later deserialization requests. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Serialization woes
    ... > serialization of an object (i.e. by implementing the ... > object and the call to the special constructor. ... its elements *until* deserialization is complete - ... aknak at aksoto dot idps dot co dot uk ...
    (microsoft.public.dotnet.languages.vb)
  • Re: calling methods on deserialized objects
    ... serialization and deserialization breaks the internal connection between hashes and their associated classes, ... What "internal connection" are you refering to? ... The serialized structure looks good (I had a look at the session text file), references are replaced by their serialized target, no memory address pointers inside ... ... respective classes after deserialization, ...
    (comp.lang.perl.modules)
  • RE: ObjectManager Problem - Plea for help!
    ... RegisterObject() should be - as the documentation for RegisterObject says - ... The problem is that during deserialization I don't know that C2.m_s is the ... constructor required for custom serialization allows there to be a level of ... the formatter code would need to change to: ...
    (microsoft.public.dotnet.framework)