TechTalk Genome v4.2

CommitEventHandler Delegate

Provides a callback interface for handling events raised while committing a logical transaction in a Context.

public delegate void CommitEventHandler(
   object sender,
   CommitEventArgs args


An unbound proxy to the persistent object being notified. When handling Context events using the IXXXXCallback interfaces sender is omitted and the implicit this parameter is used instead.
Supplementary parameters about the operation being performed and success/faliure information.


The commit events are raised before and after the logical transaction of the Context is committed using the Context.Commit method. If the operation involves an update batch the Context.BeforeCommitObject events will predcede any Context.BeforeUpdateObject events and similarly Context.AfterCommitObject events will execute as the last step of the operation after all Context.AfterUpdateObject events have been processed.

The persistent object life-cycle events are always raised for a particular persistent object being manipulated in the given Context. The value of sender indicates the persistent object of concern. In certain notification events such as in Context.BeforeCommitObject after deleting a certain object sender might specify an invalid object. In these cases only the dynamic type and the value of the identity fields of the object are accessible.

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.


Namespace: TechTalk.Genome

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


Editions: Professional, Evaluation, Express

Database Platforms: Microsoft SQL Server 2000, Microsoft SQL Server 2005, Orcale 9i Release 2, Oracle 10g Release 2

See Also

TechTalk.Genome Namespace | Context.BeforeCommitObject | Context.AfterCommitObject | ObjectEventHandler | UpdateEventHandler