Skip to content

Instantly share code, notes, and snippets.

@DannyRusnok
Created February 3, 2022 12:01
Show Gist options
  • Save DannyRusnok/e6ba64c20ba27297f34f9744ddec5fe0 to your computer and use it in GitHub Desktop.
Save DannyRusnok/e6ba64c20ba27297f34f9744ddec5fe0 to your computer and use it in GitHub Desktop.
public abstract class AggregateRoot{
private readonly List<INotification> _domainEvents = new List<INotification>();
public IReadOnlyCollection<INotification> DomainEvents => _domainEvents.AsReadOnly();
public void AddDomainEvent(INotification eventItem)
{
_domainEvents.Add(eventItem);
}
public void RemoveDomainEvent(INotification eventItem)
{
_domainEvents.Remove(eventItem);
}
public void ClearDomainEvents()
{
_domainEvents.Clear();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment