12345678910111213141516171819202122 |
- 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<IDomainEvent> _domainEvents = new();
- [NotMapped]
- public IProducerConsumerCollection<IDomainEvent> DomainEvents => _domainEvents;
- protected void PublishEvent(IDomainEvent @event)
- {
- _domainEvents.Enqueue(@event);
- }
- protected static Guid NewIdGuid() => Guid.NewGuid();
- }
- }
|