-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAggregateRoot.cs
More file actions
36 lines (30 loc) · 1.26 KB
/
AggregateRoot.cs
File metadata and controls
36 lines (30 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using BeyondNetCode.Shell.Ddd.Interfaces;
using BeyondNetCode.Shell.Ddd.Services.Impl;
namespace BeyondNetCode.Shell.Ddd
{
/// <summary>
/// Represents the base class for aggregate roots in the domain-driven design.
/// </summary>
/// <typeparam name="TAggegateRoot">The type of the aggregate root.</typeparam>
/// <typeparam name="TProps">The type of the properties of the aggregate root.</typeparam>
public abstract class AggregateRoot<TAggegateRoot, TProps> : Entity<TAggegateRoot, TProps>, IAggregateRoot
where TAggegateRoot : class
where TProps : class, IProps
{
public int Version { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="AggregateRoot{TAggegateRoot, TProps}"/> class.
/// </summary>
/// <param name="props">The properties of the aggregate root.</param>
protected AggregateRoot(TProps props) : base(props)
{
DomainEvents = new DomainEventsManager(this);
}
#region DomainEvents
/// <summary>
/// The domain events associated with the entity.
/// </summary>
public DomainEventsManager DomainEvents { get; private set; }
#endregion
}
}