OCLOperators OnCreate
No edit summary
No edit summary
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
OnCreate is often called when a new object has been created.
<message>Write the content here to display this box</message>
OnCreate is often called after a new object has been created.


It's very much like a .Net constructor for OCL.
It's very much like a .Net constructor for OCL.


You can use self.base.OnCreate to call the superclass's OnCreate as you would in another language.
You can use <code>self.base.OnCreate</code> to call the superclass's OnCreate as you would in another language.


==== Example ====
==== Example ====
Line 9: Line 10:
  CreateTime:=DateTime.Now;  
  CreateTime:=DateTime.Now;  
  self.Guid.newGuid()  
  self.Guid.newGuid()  
See more: [[Acting on object changes]]
'''See more:''' [[Documentation:Acting on object changes|Acting on object changes]]


See also: [[OCLOperators OnUpdate|OnUpdate]], [[OCLOperators OnDelete|OnDelete]], [[OnStateChange]]
'''See also:''' [[Documentation:OCLOperators OnUpdate|OnUpdate]], [[Documentation:OCLOperators OnDelete|OnDelete]], [[Documentation:OnStateChange|OnStateChange]]
[[Category:OCLOperators]]
[[Category:OCL General Operators]]
[[Category:OCL General Operators]]
{{Edited|July|12|2025}}

Latest revision as of 05:16, 6 February 2025

This page was created by Peter on 2019-11-18. Last edited by Stephanie@mdriven.net on 2025-02-06.

OnCreate is often called after a new object has been created.

It's very much like a .Net constructor for OCL.

You can use self.base.OnCreate to call the superclass's OnCreate as you would in another language.

Example

In the method body for OnCreate, set this OCL:

CreateTime:=DateTime.Now; 
self.Guid.newGuid() 

See more: Acting on object changes

See also: OnUpdate, OnDelete, OnStateChange