Fork me on GitHub

Unit of Work

The scoping event broker comes with its own unit of work implementation which can be used directly in your code or hooked into third party unit of works (i.ex. the NHibernate ISession implementation). There are two important concepts which need to be understood to work properly with the scoping event broker, namely: Let us explore what they are and what their purpose is.

Scope context

The scope context is the context which allows to create scopes. The scope context is created by the EventScopingStandardFactory. You don't need to pass around the EventScopingStandardFactory in order to be able to do scoping of events. Only the scope context is required.

Scope

The scope allows to safeguard several event invocations into one scope. Only when the scope is released properly the events will be fired while releasing the scope. The scope takes care that the events are fired in the order which they were scheduled for invocation. The scope is an IDisposable and should be used together with an using block. Below you see the different operation modes of a scope. The event will be fired. The actual event will never be fired in this case because the scope is cancelled. The actual event will never be fired in this case because the scope is disposed without being released. The actual event type will be fired as soon as the scope is released.