My question is almost answered by this: https://stackoverflow.com/a/24224465/454754 But I can't really figure out how to make it work when my property is replaced (i.e. I have a new version of the object basically).
Specifically I have a class
public class Something {
public decimal? Fee { get; set;}
}
Which I have serialized using JSON.Net and stored in an external store (database).
Now I want to have a new version of the same class:
public class Something {
public Fee Fee { get; set;}
}
public class Fee {
public decimal? Amount { get; set; }
public int Type { get; set; }
}
However i need to be able to deserialize old instances into new instance (and if i serialize them again they should be saved as the new version).
I don't mind adding new internal/private properties as long as these are not serialized.
What I would like to avoid is a new public property like NewFee
or some such.
I am probably missing something here, it feels like it should be possible with all the hooks provided by JSON.Net.