MDrivenWiki
Log in

OCLOperators OnUpdate

From MDrivenWiki
Revision as of 07:34, 19 April 2023 by Stephanie (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

OnUpdate is called just before the object is saved to the database. You can do things needed on every save operation here.

Please note! You can't create new objects from within the OnUpdate action - that will leave the newly created object unsaved.

For example, in the method body for OnUpdate, set this OCL:

if self.existing then -- This avoids touching the object if it has been deleted  
  self.ChangeTime:=DateTime.Now; 
  false 
else  
  false 
endif 

See more: Acting on object changes, IsDirty

See also: OnCreate, OnDelete, OnStateChange