Persistate

Event firing sequences

Hide Navigation Pane

Event firing sequences

Previous topic Next topic No directory for this topic  

Event firing sequences

Previous topic Next topic Topic directory requires JavaScript JavaScript is required for the print function Mail us feedback on this topic!  

In certain circumstances, for example when you add an object to a collection, a number of Persistate events are fired.  See the Object class events and Persistent events sections for details of these events.  The following subsections give details of the firing order of these events and related functions.

Note that the TransactionListsUpdated event is not shown in the following sequences.  It occurs at least once in each sequence, every time an object is modified, or a link is made or broken.

Assignment to member

When you modify an object using one of the generated member properties with a data class, the following happens.

1.If the object was previously unmodified since the last commit, a clone of the object is taken if its class category has the clone on mutate function.
2.The value of the property is set to the new value.
3.The Modified event is fired for the current object, followed by the InstanceModified event for its ObjectClass object, and all its base ObjectClass objects, starting with the least derived.

Assignment to contained scalar object member

This sequence happens when you assign a value – either null or a new child object – into a contained (non-associated) scalar object member of a parent object using the generated property.

1.If the parent object was previously unmodified since the last commit, a clone of the parent object is taken if its class category has the clone on mutate function.
2.If there was a previous child object in this member which is being overwritten, the Deleted event is fired for the previous child object followed by the InstanceDeleted event for its ObjectClass and base ObjectClass objects, starting with the least derived.
3.If there was a previous child object, the Disowned event is fired for it followed by the InstanceDisowned event for its ObjectClass and base ObjectClass objects, starting with the least derived.
4.The value of the property is set to the new value – null or the new child.
5.Unless the new value is null, the Assignment to member sequence listed above occurs for the new child object, as the child’s Parent property is set to the parent object.
6.Unless the new value is null, the Adopted event is fired for the new child object, followed by the InstanceAdopted event for its ObjectClass and base ObjectClass objects, starting with the least derived.
7.The Modified event is fired for the parent object, followed by the InstanceModified event for its ObjectClass object, and all its base ObjectClass objects, starting with the least derived.

Addition to contained collection

When you add a new child object into a contained (non-associated) collection of a parent object, the following happens.

1.If there was a previous child object in the collection at that position (if you added using the indexer), the Deleted event is fired for the previous child object followed by the InstanceDeleted event for its ObjectClass and base ObjectClass objects, starting with the least derived.
2.If there was a previous child object in the collection at that position (if you added using the indexer), the Disowned event is fired for the previous child object followed by the InstanceDisowned event for its ObjectClass and base ObjectClass objects, starting with the least derived.
3.The Assignment to member sequence listed above occurs for the new child object, as its Parent property is set to the parent object.  For ordered collections, this happens slightly earlier as the Order member of the child is set.
4.The Adopted event is fired for the new child object, followed by the InstanceAdopted event for its ObjectClass and base ObjectClass objects, starting with the least derived.
5.The Changed event is fired for the collection's IndexedList object.

Assignment to associated scalar object member

When you assign a new value - which may be null – into an associated single member of a container object using the generated property, the following happens.

1.If the parent object was previously unmodified since the last commit, a clone of the parent object is taken if its class category has the clone on mutate function.
2.If there was a previous object in this member which is being overwritten, the Dissociated event is fired for the previous object, followed by the InstanceDissociated event for its ObjectClass and base ObjectClass objects, starting with the least derived.
3.The value of the container property is set to the new value – null or the new associated object.
4.If the new value is not null, the Associated event is fired for the new object, followed by the InstanceAssociated event for its ObjectClass and base ObjectClass objects, starting with the least derived.
5.The Modified event is fired for the container object, followed by the InstanceModified event for its ObjectClass object, and all its base ObjectClass objects, starting with the least derived.

Addition to associated collection

When you add a new object into an associated collection of a container object, the following happens.

1.If there was a previous object in the collection at that position (if you added using the indexer), the Dissociated event is fired for the previous child object followed by the InstanceDissociated event for its ObjectClass and base ObjectClass objects, starting with the least derived.
2.If the collection is ordered, the Assignment to member sequence listed above occurs for the new object as its Order property is set.
3.The Associated event is fired for the new object, followed by the InstanceAssociated event for its ObjectClass and base ObjectClass objects, starting with the least derived.
4.The Changed event is fired for the collection's IndexedList object.

Removal from contained collection

When you remove a child object from a contained (non-associated) collection of a parent object, the following happens.

1.The Deleted event is fired for the child object being removed followed by the InstanceDeleted event for its ObjectClass and base ObjectClass objects, starting with the least derived.
2.The Disowned event is fired for the child object being removed followed by the InstanceDisowned event for its ObjectClass and base ObjectClass objects, starting with the least derived.
3.The Changed event is fired for the collection's IndexedList object.

Removal from associated collection

When you remove an object from an associated collection of a container object, the following happens.

1.The Dissociated event is fired for the object being removed followed by the InstanceDissociated event for its ObjectClass and base ObjectClass objects, starting with the least derived.
2.The Changed event is fired for the collection's IndexedList object.

Moving a contained object

When you move a contained object from one parent to another using the Persistent.Move method, the following happens.

1.The Disowned event is fired for the object followed by the InstanceDisowned event for its ObjectClass and base ObjectClass objects, starting with the least derived.
2.If the object is being moved to a scalar member, the Assignment to contained scalar object member sequence is followed.
3.If the object is being moved to a collection member the Addition to contained collection sequence is followed.