/// <summary>
 /// Registers a behaviour with the context ensuring
 /// it is consulted for each event fired on this context.
 /// </summary>
 /// <param name="behaviour">The behaviour to register with this context.</param>
 public virtual void Register(IProcessBehaviour behaviour)
 {
     this.Bus.Where(behaviour.Condition).Subscribe(
         (IEvent ev) => {
         try {
             behaviour.Action(ev);
         } catch (Exception err) {
             behaviour.Rescue(ev, err);
         }
     }
         );
 }
Beispiel #2
0
 /// <summary>
 /// Registers a behaviour with the context ensuring
 /// it is consulted for each event fired on this context.
 /// </summary>
 /// <param name="behaviour">The behaviour to register with this context.</param>
 public void Register(IProcessBehaviour behaviour)
 {
     this.Bus.Where(behaviour.Condition).Subscribe((IEvent ev) => behaviour.Action(ev));
 }