void IEventSourcedAggregate.ApplyChanges(Changeset changeset) { // skip if same version if (changeset.AggregateVersion == this.Version) { return; } if (changeset.AggregateVersion != this.Version + 1) { throw new AggregateRestoreException(this.Version + 1, changeset.AggregateVersion); } this.Version = changeset.AggregateVersion; foreach (var @event in changeset.Events) { this.Dispatch(@event); } }
void IEventSourcedAggregate.ChangesPersisted(Changeset changeset) { this.Version = changeset.AggregateVersion; this.PendingChanges.Clear(); }