best practice to persist classes model
- by Yaron Naveh
My application contains a set of model classes. e.g. Person, Department...
The user changes values for instances of these classes in the UI and the classes are persisted to my "project" file. Next time the user can open and edit the project.
Next version of my product may change the model classes drastically. It will still need to open existing projects files (I will know how to handle missing data).
How is it best to persist my model classes to the project file?
The easiest way to persist classes is Data contract serialization. However it will fail on breaking changes (I expect to have such). How to handle this?
use some other persistence, e.g. name-value collection or db which is more tolerance
ship a "project converter" application to migrate old projects. This requires to either ship with both old and new models or to manipulate xml, which is best?