Refactored to follow naming convention
This commit is contained in:
26
dotnet/AipsCore/Domain/Abstract/DomainModel.cs
Normal file
26
dotnet/AipsCore/Domain/Abstract/DomainModel.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using AipsCore.Domain.Common.ValueObjects;
|
||||
|
||||
namespace AipsCore.Domain.Abstract;
|
||||
|
||||
public abstract class DomainModel<TId> where TId : DomainId
|
||||
{
|
||||
private readonly List<IDomainEvent> _domainEvents = [];
|
||||
|
||||
public TId Id { get; init; }
|
||||
|
||||
protected DomainModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected DomainModel(TId id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public IReadOnlyList<IDomainEvent> GetDomainEvents() => _domainEvents.ToList();
|
||||
|
||||
public void ClearDomainEvents() => _domainEvents.Clear();
|
||||
|
||||
protected void RaiseDomainEvent(IDomainEvent domainEvent) => _domainEvents.Add(domainEvent);
|
||||
}
|
||||
Reference in New Issue
Block a user