August 31st, 2009, 08:04 PM
Object persistance using MVVM
This forum seems a bit quiet, if you cant answer my question, could you possibly point out a good forum that deals with the MVVM pattern?
I am using WPF and the MVVM architecture. The problem is that I have a user control that edits the properties of an object. All the textbox's are bound to the relevant object in my model (through the viewmodel).
I want to know what to do when the user DOESNT save this information (they may navigate away, or press the cancel button). The problem is that if they edit the textbox, the model gets changed without the model being persisted to the database. So if they come back to view that object, it will appear as though the changes they made, last time when they were looking at the object, have changed the database. Of course they havent. I want the model to reflect the database. How is everyone solving this simple problem.
Does this make sense?
Its a very simple problem, but i dont know how everyone is getting around it.. what is the design pattern commonly used to solve this problem?
Click Here to Expand Forum to Full Width