Up Save
DevForce Resource Center » Development guide » Save » Validate before a save

Validate before a save

Last modified on September 17, 2012 16:17

By default DevForce validates every entity on the server before saving it to the data source.

The default validation behavior can be modified by overriding the ValidateSave method in a custom EntityServerSaveInterceptor.

Unknown macro: IBNote

Also see the topic on server-side validation for more information.

Handling validation errors

If any validation errors are encountered on the server, there are two mechanisms by which these errors are reported back to the EntityManager that performed the save:

  • Any errors will be propagated back to the "errant" entities within the calling EntityManager's cache and each of these entities will have its EntityAspect.ValidationErrors property automatically updated. If these entities have been bound to a client side UI and because of the eventing behavior provided by the ValidationErrors property and DevForce's implementation of the INotifyDataErrorInfo and IDataErrorInfo interfaces these errors should appear immediately in the client side UI.
  • The EntityManagerSaveException.EntitiesWithErrors property of the EntityManagerSaveException reported by the EntityManager.Saved event and the SaveResult, will contain these errant entities.

Any errors encountered can then be corrected and the save resubmitted.

Created by DevForce on February 19, 2011 18:59

This wiki is licensed under a Creative Commons 2.0 license. XWiki Enterprise 3.2 - Documentation. Copyright © 2020 IdeaBlade