Adds the base class of all metadata objects

This commit is contained in:
BinaryAlley committed 2024-08-18 14:18:04 +03:00
1 parent 1667036009
commit 1e902e47dc
6 files changed
+109 -4

No files matched your search

@@ -0,0 +1,31 @@
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, TIdType> : Entity<TId> where TId : notnull, AggregateRootId<TIdType>
where TIdType : notnull
{
#region ==================================================================== PROPERTIES =================================================================================
public new AggregateRootId<TIdType> Id { get; protected set; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Overload C-tor.
/// </summary>
/// <param name="id">The id of the entity.</param>
protected AggregateRoot(TId id) : base(id)
{
Id = id;
}
#pragma warning disable CS8618
protected AggregateRoot() // only needed during reflection
{
}
#pragma warning restore CS8618
#endregion
}