changing the serialization procedure for a graph of objects (.net framework)
- by pierusch
Hello
I'm developing a scientific application using .net framework.
The application depends heavily upon a large data structure (a tree like structure) that has been serialized using a standard binaryformatter object.
The graph structure looks like this:
<serializable()>Public class BigObjet
inherits list(of smallObject)
end class
<serializable()>public class smallObject
inherits list(of otherSmallerObjects)
end class
...
The binaryFormatter object does a nice job but it's not optimized at all and the entire data structure reaches around 100Mb on my filesystem. Deserialization works too but it's pretty slow (around 30seconds on my quad core).
I've found a nice .dll on codeproject (see "optimizing serialization...") so I wrote a modified version of the classes above overriding the default serialization/deserialization procedure reaching very good results.
The problem is this: I can't lose the data previosly serialized with the old version and I'd like to be able to use the new serialization/deserialization method. I have some ideas but I'm pretty sure someone will be able to give me a proper and better advice !
use an "helper" graph of objects who takes care of the entire serialization/deserialization procedure reading data from the old format and converting them into the classes I nedd. This could work but the binaryformatter "needs" to know the types being serialized so........ :(
modify the "old" graph to include a modified version of serialization procedure...so I'll be able to deserialize old file and save them with the new format......this doesn't sound too good imho.
well any help will be higly highly appreciated :)