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.
interface is implemented to facilitate validations by allowing you to call:
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.
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
no errors. In addition, when fired, it will call ValidateAll()
and only if this call succeeds, will then call
. Use OnCommitted
to process any changes necessary - Jounce will then set the Committed flag to true.