using MediatR; namespace ZeroFramework.DeviceCenter.Domain.Entities { public abstract class BaseAggregateRoot : BaseEntity, IAggregateRoot, IDomainEvents { private readonly List _domainEvents = []; public IReadOnlyCollection DomainEvents => _domainEvents.AsReadOnly(); public void AddDomainEvent(INotification eventItem) => _domainEvents.Add(eventItem); public void RemoveDomainEvent(INotification eventItem) => _domainEvents?.Remove(eventItem); public void ClearDomainEvents() => _domainEvents?.Clear(); } public abstract class BaseAggregateRoot : BaseEntity, IAggregateRoot, IDomainEvents { private readonly List _domainEvents = []; public IReadOnlyCollection DomainEvents => _domainEvents.AsReadOnly(); public void AddDomainEvent(INotification eventItem) => _domainEvents.Add(eventItem); public void RemoveDomainEvent(INotification eventItem) => _domainEvents?.Remove(eventItem); public void ClearDomainEvents() => _domainEvents?.Clear(); } }