TechTalk Genome v4.2

Context.BeforeCommitObject Event

Raised for persistent objects being committed but before any other persistent object is committed into the DataDomain as a result of calling Commit on this Context.

public event CommitEventHandler BeforeCommitObject;

Implements

IContext.BeforeCommitObject

Remarks

Signals that sender is about to be comitted in the given Context. Depending on the synchornization state of sender the object may or may not be updated into the corresponding DataDomain during the commit operation. The value of UpdateEvents indicates the logical operation being performed on sender. The value of CommitResults is set to CommitResults.None.

The event is raised before the update batch would execute and even before any BeforeUpdateObject events would be raised. The event is raised for all individual persistent objects that have been involved into the current logical transaction of the Context regardless of whether it is necessary to update the object in the upcomming update batch. The order in which individual persistent objects are notified in indeterministic. The event is raised for deleted objects as well, however the proxy specified by sender can not be dereferenced in the current Context.

The subscriber of the event may freely modify sender or any other persisent objects. Changes performed while processing the event will be also committed in the very same logical transaction. If any synchronized persistent object is modified during the execution of the BeforeCommitObject event then both ChangeObject and BeforeCommitObject events will be signaled for the modified object. The BeforeCommitObject event is raised only once for any involved persistent object, even if the concerned object has been further modified after notifying it.

Events raised by the Context can be captured from different areas of interest. The developer may choose to capture a certain event originating from a certain Context by subscribing to one of the Context events using the standard .NET event mechanism. This allows for multiple queued event processors and dynamic strategies in handling events. The order in which subscribers are notified is nondeterministic and hence no subscriber should perform operations with side-effects that would affect the execution of other subscribers or that assumes a certain execution order. This way of processing Context events is similar to handling events raised by ADO.NET DataTable.

The developer might optionally choose to process Context events on persistent objects directly. In this case the class implementing persistency should be inherited from the corresponding callback interface. Each callback interface defines one method to implement with a similar signature as the corresponding event delegate. When the Context raises an event for a persistent object it executes the callback method whenever the object implements the appropriate callback interface. This practically ensures that the object is always subscribed to all events of any Context that it is interested in regardless of how the Context itself is configured by the caller.

The Context that raises the event will automatically become the active Context in the calling thread for the duration of the call. This ensures that any unbound proxies used in the event handlers are resolved from the relevant Context. When the events have been successfully processed, the context stack of the calling thread is restored to its previous state.

Requirements

Namespace: TechTalk.Genome

Assembly: TechTalk.Genome (in TechTalk.Genome.dll)

Version: 4.2.11.59

Editions: Professional, Evaluation, Express

See Also

Context Class | TechTalk.Genome Namespace | IBeforeCommitCallback | Commit