TechTalk Genome v4.2

ObjectEventHandler Delegate

Provides a callback interface for handling general purpose persistent object life-cycle events provided by the Context.

public delegate void ObjectEventHandler(
   object sender
);

Parameters

sender
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.

Remarks

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.

Requirements

Namespace: TechTalk.Genome

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

Version: 4.2.11.59

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.LoadObject | Context.ChangeObject | Context.DeleteObject | UpdateEventHandler | CommitEventHandler