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

Entity View Models

Use the BaseEntityViewModel for view models that help facilitate CRUD operations or drive interactive forms with validation.

The entity view models are dervied from Basic View Models but add additional functionality.

The INotifyDataErrorInfo interface is implemented to facilitate validations by allowing you to call:

if (!_Validate())
   SetError(()=>Property,"There was an error with this property."); 

Using the built-in validation framework with Silverlight, errors registered with these commands will appear in the UI and also in any validation summary controls such as those offered by the Silverlight toolkit.

Override ValidateAll() to provide aggregate validation over multiple properties.

This view model also exposes the Committed flag, which is like an inverse dirty flag. The initial state of the view model should be to set Committed to "true" meaning any changes needed have been committed (as the fields have not been touched). Jounce will automatically detect when a property has changed and set Committed to false. In addition, the CommitCommand can be bound to your save functionality. It will remain disabled unless there are pending changes and no errors. In addition, when fired, it will call ValidateAll() and only if this call succeeds, will then call OnCommitted(). Use OnCommitted to process any changes necessary - Jounce will then set the Committed flag to true.

Last edited May 12, 2011 at 3:44 AM by pbrooks, version 4


No comments yet.