This project is read-only.

The Event Manager

Assembly EnterpriseLibraryExtensions.Events.dll
 Namespace EnterpriseLibraryExtensions. Events
 Class EventManager

The EventManager class is responsible for mediating communication between event producers and event handlers. To use the EventManager, make the EventManager inject the IEventProducer and IEventRegistration into you Unity container by calling:


When the registration is completed, you can retrieve either the event registration manager or event
producer interfaces by calling:

var eventRegistration = container.Resolve<IEventRegistration>(); 
var eventProducer = container.Resolve<IEventProducer>();

To register an event handler use the eventRegistration like this:

eventRegistration.Register<SampleEventType, SampleEventHandlerAsync>();

Where the first type parameter is the type of event to register a handler for and the second type parameter
is the type of handler itself.

Now, using the eventProducer, it is possible to raise the SampleEventType event.

eventProducer.Raise(null, new SampleEventType("Hello World"));

Last edited Apr 24, 2012 at 7:16 PM by RasmusTherkelsen, version 2


No comments yet.