Documentation Center

Event Handler implementation guidelines

This topic provides some more insight into how Event Handler subscription and disposal works, and how to implement it.

Multithreading
Because subscribed Event Handler may be invoked concurrently from multiple Sessions running in the application domain, make sure that your implementation is thread-safe.
Lifetime
The lifetime of subscribed Event Handler is the same as the lifetime of the application domain.
IDisposable
Your subclass can implement IDisposable but Tridion Sites will not call it. You must do this yourself.
Session objects and Session-related objects
Do not cache a Session object or any Session-related object (which means most TOM.NET objects) in the state of your Event Handler instance, nor in a static state.
Unsubscribing
You may wish to explicitly unsubscribe your Event Handler when the application domain unloads, but this is not strictly necessary.