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); }
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(); } }
protected void ApplyChange(EventBase @event) { ApplyChange(@event, true); }