I have data that has been stored using binary serialization for the following class:
[Serializable]
public abstract class BaseBusinessObject
{
private NameValueCollection _fieldErrors = new NameValueCollection();
protected virtual NameValueCollection FieldErrors
{
get { return _fieldErrors; }
set { _fieldErrors = value; }
}
...
}
At some point, the class was changed to this:
[Serializable]
public abstract class BaseBusinessObject
{
private Dictionary<string, string> _fieldErrors = new Dictionary<string, string>();
protected virtual Dictionary<string, string> FieldErrors
{
get { return _fieldErrors; }
set { _fieldErrors = value; }
}
...
}
This is causing issues deserializing old data.
My first thought was to implement ISerializable
, but this class has numerous properties as well as hundreds of inheriting classes that I would have to implement this for as well.
I would like to either change the old data to match the current structure during deserialization or have a clean way of upgrading the old data.