Our task is quite simple: we have an object graph where each object (IDItem) has a unique identifier. The graph of objects exists twice, on the client and on the server.
Now we send some serializable commands to the server. The command has some IDItems as fields. IDItems implement the ISerializable interface and store only their identifier in SerializationInfo. How:
void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("ID", this.GetID());
}
The problem is, how can we assign an existing object to the instance created by the deserializer? Obviously, something like the following in the ISerializable constructor does not work, because the identifier 'this' is read-only:
protected IDItem(SerializationInfo info, StreamingContext context)
{
this = GlobalObject.GetIDItem(info.GetString("ID"));
}
So, any idea how we can Assign an existing object to a deserialized object?
Best regards, thalm