This project is read-only.

How to subscribe to events

Every time something changes in a domain an event is raised. To every command, there is an associated event which can be of two kinds :
  • Primitives : Raised by the primitive commands. Primitive commands and theirs associated events are :
    • AddEntityCommand -> AddEntityEvent
    • RemoveEntityCommand -> RemoveEntityEvent
    • AddRelationshipCommand -> AddRelationshipEvent
    • RemoveRelationshipCommand -> RemoveRelationshipEvent
    • ChangePropertyValueCommand -> ChangePropertyValueEvent
    • AddSchemaEntityCommand -> AddSchemaEntityEvent
    • AddSchemaRelationshipCommand -> AddSchemaRelationshipEvent
    • AddSchemaPropertyCommand -> AddSchemaPropertyEvent
  • Customs : Raised by your custom command

Events are raised when the session is disposed and only if it has been not aborted.

Subscribing to events

All events are raised by the Domain EventManager available with the Events property of a domain. The event manager exposes an IObservable property for each kind of event.

Example :

In addition of the properties correspond to the eight primitive events, the CustomEvent property is available for... custom event.

You can notice there are two properties by event :
  • xxxRaised : Raised when a not aborted session is disposed.
  • xxxRaising : Raised iImmediately after the command is executed. Be careful here, if you want to execute something depending of the event, there is no assumption about how the session will terminate (aborted or not).

Specific event

There is two additional events used to subscribe :
  • To all errors raised during a session with the OnErrors property.
  • When a session is completed (aborted or not) with the SessionCompleted property

How to unsubscribe

The Subscribe method returns an IDIsposable object, you can used to unsubscribe by using its Dispose method.

By default, the event manager doesn't use Reactive Extension but it is fully compatible. You can see how to enable Reactive Extension here.

Last edited Apr 17, 2014 at 9:04 PM by Zenasoft, version 5