Browse Source

Merge 59da019d11 into 672d7186d1

pull/556/merge
Alex Kryvdyk 6 years ago
committed by GitHub
parent
commit
5f37a17657
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions
  1. +7
    -3
      src/Services/Ordering/Ordering.Domain/SeedWork/Entity.cs
  2. +1
    -1
      src/Services/Ordering/Ordering.Infrastructure/MediatorExtension.cs

+ 7
- 3
src/Services/Ordering/Ordering.Domain/SeedWork/Entity.cs View File

@ -24,7 +24,7 @@
}
}
public List<INotification> DomainEvents => _domainEvents;
public IReadOnlyCollection<INotification> DomainEvents => _domainEvents?.AsReadOnly();
public void AddDomainEvent(INotification eventItem)
{
_domainEvents = _domainEvents ?? new List<INotification>();
@ -33,8 +33,12 @@
public void RemoveDomainEvent(INotification eventItem)
{
if (_domainEvents is null) return;
_domainEvents.Remove(eventItem);
_domainEvents?.Remove(eventItem);
}
public void ClearDomainEvents()
{
_domainEvents?.Clear();
}
public bool IsTransient()


+ 1
- 1
src/Services/Ordering/Ordering.Infrastructure/MediatorExtension.cs View File

@ -19,7 +19,7 @@ namespace Ordering.Infrastructure
.ToList();
domainEntities.ToList()
.ForEach(entity => entity.Entity.DomainEvents.Clear());
.ForEach(entity => entity.Entity.ClearDomainEvents());
var tasks = domainEvents
.Select(async (domainEvent) => {


Loading…
Cancel
Save