How to deal with serialization and deserialization of objects with dependencies -


suppose have 2 objects depend on each other or other objects(so use references these objects) , need save/restore "state" from/to disk. since storing pointers disk not produce correct results on restore, how keep dependencies correct on restore?

e.g.,

class {    b b; }  class b { {    a; } 

(or more complex chains may have n-cycles of dependencies)

a = deserialize(adata) b b = deserialize(bdata)

(and suppose need a.b = b , b.a = a)

i'm thinking having unique hashes objects lazy evaluation solve problem maybe there better ways? (if have unique hash easy find object use , save , restore object(basically hash acts pointer valid(since unique , never changes))


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -