[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pnet-developers] Problems with ObjectManager and SerializationInfo
From: |
Andre 'Ilu' Seidelt |
Subject: |
[Pnet-developers] Problems with ObjectManager and SerializationInfo |
Date: |
Sun, 09 May 2004 19:18:00 +0200 |
User-agent: |
Mozilla Thunderbird 0.6 (Windows/20040502) |
Hi list,
I got a problem when deserializing classes which implement ISeralizable:
When reading the object definition for e.g. Hashtable I get the TypeName
from the
stream and that enables me (by loading the Type) to check if the class
implements
ISerializable.
If so, I create a SerializationInfo object which will get the 'pseudo'
members of the
object from the stream as key->value pairs.
Normaly I would just call the .ctor() with the SerializationInfo and the
object would
be fine, but the stream contains forward references to other objects
which I do not
have when calling the .ctor().
For 'normal' objects (and arrays) I can use the ObjectManager to handle
this. I just
register the curent object with it's ID and then register fixups for
each of the members
which are forward references.
How do I handle that for ISerializable?
I tried to register the 'empty' object with an 'empty' SerializationInfo
and put the
forward references into the SerializationInfo by name using the
ObjectManager,
but that fails because the ObjectManager does not handle fixups for a
SerializationInfo an other way than for other objects. I implemented that
'special handling', but now I face the problem, that the .ctor() of the
object has to be
called with the SerializationInfo and the StreaminContext and I don't
know if this is
the right way to put this into the ObjectManager.
Can anybody enlighten me how to handle this case?
I thought there would be something like
obj = FormatterServices.CreateEmptyObject();
info = new SerializationInfo();
ObjectMananger.registerFixup(id, obj, info);
info.AddValue(<name of field>, <forward reference id>);
ObjectMananger.doFixup();
regards
Ilu
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pnet-developers] Problems with ObjectManager and SerializationInfo,
Andre 'Ilu' Seidelt <=