예제 #1
0
 private void ApplyChange(EventBase @event, bool isNew)
 {
     this.AsDynamic().Apply(@event);
     this.Version++;
     @event.Version = this.Version;
     @event.AggregateId = this.Id;
     if(isNew) _changes.Add(@event);
 }
예제 #2
0
 public void Publish(EventBase @event)
 {
     var handlers = this.GetCommandActions(@event.GetType()).ToList();
     if (!handlers.Any()) return;
     foreach(var handler in handlers)
     {
         var handler1 = handler;
         handler1.AsDynamic().Handle(@event);
         ((IDisposable)handler).Dispose();
     }
 }
예제 #3
0
 protected void ApplyChange(EventBase @event)
 {
     ApplyChange(@event, true);
 }