protected void Apply(DomainEvent domainEvent) { if (domainEvent is EntityBasedDomainEvent @event) { if (@event.EntityId != Id) { When(domainEvent); domainEvent.SetHandled(); } } else { When(domainEvent); domainEvent.SetHandled(); } _addtionalApplier(domainEvent); }
protected virtual void Apply(DomainEvent domainEvent) { if (domainEvent.IsHandled() == false || (EventHandlingStrategy == EventHandlingStratgies.Multiple)) { When(domainEvent); domainEvent.SetHandled(); } //EnsureValidState(); _additionalApplier?.Invoke(domainEvent); }