using AipGateway.API.Domain.IServices.IUtilities; using System.Collections.Concurrent; using System.ComponentModel.DataAnnotations.Schema; namespace AipGateway.API.Domain.Common.DomainEvent { internal class HasDomainEventEntity : IHasDomainEventEntity { [NotMapped] private readonly ConcurrentQueue _domainEvents = new(); [NotMapped] public IProducerConsumerCollection DomainEvents => _domainEvents; protected void PublishEvent(IDomainEvent @event) { _domainEvents.Enqueue(@event); } protected static Guid NewIdGuid() => Guid.NewGuid(); } }