This project has moved and is read-only. For the latest updates, please go here.

How to implementing DirtyChecking (Viewmodel,Model) using WAF

Dec 23, 2012 at 6:12 AM
Edited Dec 23, 2012 at 6:13 AM


I was trying to implement Dirty Checking on my ViewModels. I did this by using the controller to linsten to the proerty changes and then changing the value of the property `IsDirty and required.

But how to use it in the scenario where the Model Object is getting dirty...

for example : In the Person Object value of Name property changes and this property was bound to a text box.

Also is there any specific to maintain the object state so that changes can be canceled ??

Thanks for really nice framework.

Dec 31, 2012 at 4:47 PM

The WPF Application Framework (WAF) does not support dirty tracking. However, the BookLibrary and the Writer sample applications show two ways to solve it.

BookLibrary: Uses the Entity Framework to track the object (entity) states.
See BookLibrary.Library.Domain\BookLibraryEntities.cs (HasChanges property).

Writer: Very simple approach by introducing the Modified flag in the Document class.
See Writer.Applications\Documents\Document.cs (see Modified property).