|
|
|
@ -1,15 +1,31 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Collections.ObjectModel; |
|
|
|
using Volo.Abp.Auditing; |
|
|
|
using Volo.Abp.Data; |
|
|
|
|
|
|
|
namespace Volo.Abp.Domain.Entities |
|
|
|
{ |
|
|
|
[Serializable] |
|
|
|
public abstract class AggregateRoot : Entity, IAggregateRoot, IGeneratesDomainEvents |
|
|
|
public abstract class AggregateRoot : Entity, |
|
|
|
IAggregateRoot, |
|
|
|
IGeneratesDomainEvents, |
|
|
|
IHasExtraProperties, |
|
|
|
IHasConcurrencyStamp |
|
|
|
{ |
|
|
|
public Dictionary<string, object> ExtraProperties { get; protected set; } |
|
|
|
|
|
|
|
[DisableAuditing] |
|
|
|
public string ConcurrencyStamp { get; set; } |
|
|
|
|
|
|
|
private readonly ICollection<object> _localEvents = new Collection<object>(); |
|
|
|
private readonly ICollection<object> _distributedEvents = new Collection<object>(); |
|
|
|
|
|
|
|
protected AggregateRoot() |
|
|
|
{ |
|
|
|
ExtraProperties = new Dictionary<string, object>(); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual void AddLocalEvent(object eventData) |
|
|
|
{ |
|
|
|
_localEvents.Add(eventData); |
|
|
|
@ -25,7 +41,7 @@ namespace Volo.Abp.Domain.Entities |
|
|
|
return _localEvents; |
|
|
|
} |
|
|
|
|
|
|
|
public IEnumerable<object> GetDistributedEvents() |
|
|
|
public virtual IEnumerable<object> GetDistributedEvents() |
|
|
|
{ |
|
|
|
return _distributedEvents; |
|
|
|
} |
|
|
|
@ -35,27 +51,36 @@ namespace Volo.Abp.Domain.Entities |
|
|
|
_localEvents.Clear(); |
|
|
|
} |
|
|
|
|
|
|
|
public void ClearDistributedEvents() |
|
|
|
public virtual void ClearDistributedEvents() |
|
|
|
{ |
|
|
|
_distributedEvents.Clear(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Serializable] |
|
|
|
public abstract class AggregateRoot<TKey> : Entity<TKey>, IAggregateRoot<TKey>, IGeneratesDomainEvents |
|
|
|
public abstract class AggregateRoot<TKey> : Entity<TKey>, |
|
|
|
IAggregateRoot<TKey>, |
|
|
|
IGeneratesDomainEvents, |
|
|
|
IHasExtraProperties, |
|
|
|
IHasConcurrencyStamp |
|
|
|
{ |
|
|
|
public Dictionary<string, object> ExtraProperties { get; protected set; } |
|
|
|
|
|
|
|
[DisableAuditing] |
|
|
|
public string ConcurrencyStamp { get; set; } |
|
|
|
|
|
|
|
private readonly ICollection<object> _localEvents = new Collection<object>(); |
|
|
|
private readonly ICollection<object> _distributedEvents = new Collection<object>(); |
|
|
|
|
|
|
|
protected AggregateRoot() |
|
|
|
{ |
|
|
|
|
|
|
|
ExtraProperties = new Dictionary<string, object>(); |
|
|
|
} |
|
|
|
|
|
|
|
protected AggregateRoot(TKey id) |
|
|
|
: base(id) |
|
|
|
{ |
|
|
|
|
|
|
|
ExtraProperties = new Dictionary<string, object>(); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual void AddLocalEvent(object eventData) |
|
|
|
@ -73,7 +98,7 @@ namespace Volo.Abp.Domain.Entities |
|
|
|
return _localEvents; |
|
|
|
} |
|
|
|
|
|
|
|
public IEnumerable<object> GetDistributedEvents() |
|
|
|
public virtual IEnumerable<object> GetDistributedEvents() |
|
|
|
{ |
|
|
|
return _distributedEvents; |
|
|
|
} |
|
|
|
@ -83,7 +108,7 @@ namespace Volo.Abp.Domain.Entities |
|
|
|
_localEvents.Clear(); |
|
|
|
} |
|
|
|
|
|
|
|
public void ClearDistributedEvents() |
|
|
|
public virtual void ClearDistributedEvents() |
|
|
|
{ |
|
|
|
_distributedEvents.Clear(); |
|
|
|
} |
|
|
|
|