Files
Nemera/src/Lumina.Domain/Common/Models/Core/AggregateRoot.cs
T

29 lines
1.0 KiB
C#

namespace Lumina.Domain.Common.Models.Core;
/// <summary>
/// Base class for all domain Aggregate Roots.
/// </summary>
/// <typeparam name="TId">The type representing the unique identifier for the Aggregate Root. It should be a non-nullable type.</typeparam>
public abstract class AggregateRoot<TId> : Entity<TId> where TId : notnull
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="AggregateRoot{TId}"/> class.
/// </summary>
/// <param name="id">The id of the entity.</param>
protected AggregateRoot(TId id) : base(id)
{
Id = id;
}
#pragma warning disable CS8618
/// <summary>
/// Initializes a new instance of the <see cref="AggregateRoot{TId}"/> class.
/// </summary>
protected AggregateRoot() // only needed during reflection
{
}
#pragma warning restore CS8618
#endregion
}