Serializing a graph with bidirectional links, (dll) imported types and versioning ..?

You can accomplish this with BinaryFormatter or SoapFormatter These formatters work with arbitrary object graphs, and will handle any objects they encounter (so long as the objects' types are marked Serializable ) and will correctly preserve cyclic references. If you are curious to see how the objects are serialized, use SoapFormatter, which will output XML Note that any assemblies that could be loaded on demand will have to be in the GAC, or the runtime won't find them To deal with versioning, you could do something like this: Serializable public class SomeVersionedClass : IDeserializationCallback { private const int CURRENT_VERSION = 10; private int version = CURRENT_VERSION; void IDeserializationCallback. OnDeserialization(object sender) { if (version!

= CURRENT_VERSION) throw new ApplicationException( "Mismatch between serialized data version " + version + " and required version " + CURRENT_VERSION + ". "); } } Note that you might consider, instead of throwing an exception, migrating data from a previous version layout to the new version. Also, beware that removing serialized fields from a class will prevent future deserialization completely, so if you plan to allow migration away from a field that is no longer in use, you will have to leave that field in so that previous versions can deserialize properly (and, of course, so you can get at the data to migrate it).

You can accomplish this with BinaryFormatter or SoapFormatter. These formatters work with arbitrary object graphs, and will handle any objects they encounter (so long as the objects' types are marked Serializable) and will correctly preserve cyclic references. If you are curious to see how the objects are serialized, use SoapFormatter, which will output XML.

Note that any assemblies that could be loaded on demand will have to be in the GAC, or the runtime won't find them. To deal with versioning, you could do something like this: Serializable public class SomeVersionedClass : IDeserializationCallback { private const int CURRENT_VERSION = 10; private int version = CURRENT_VERSION; void IDeserializationCallback. OnDeserialization(object sender) { if (version!

= CURRENT_VERSION) throw new ApplicationException( "Mismatch between serialized data version " + version + " and required version " + CURRENT_VERSION + ". "); } } Note that you might consider, instead of throwing an exception, migrating data from a previous version layout to the new version. Also, beware that removing serialized fields from a class will prevent future deserialization completely, so if you plan to allow migration away from a field that is no longer in use, you will have to leave that field in so that previous versions can deserialize properly (and, of course, so you can get at the data to migrate it).

My 5 minute Google kung-fu seems to weak... :) – IUsedToBeAPygmy Dec 27 '10 at 22:02 Bidirectional and cyclic links will be handled transparently by the formatters; there is nothing you need to do to persist them. I will update my answer to provide a mechanism for dealing with versioning. – cdhowie Dec 27 '10 at 23:35.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions