best practice to persist classes model
        Posted  
        
            by Yaron Naveh
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Yaron Naveh
        
        
        
        Published on 2010-06-08T20:33:45Z
        Indexed on 
            2010/06/08
            20:42 UTC
        
        
        Read the original article
        Hit count: 329
        
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?
 
© Stack Overflow or respective owner