Appearance
BaseEntity
Base classes for domain entities with identity, audit fields, and soft delete.
BaseEntity
The Guid-key base entity creates its identifier and creation timestamp by default. Its methods include Delete(Guid?), Restore(), MarkAsUpdated(Guid?), and SetCreatedBy(Guid?).
csharp
using Gryd.Domain.Primitives;
public sealed class Product : BaseEntity
{
public string Name { get; private set; } = string.Empty;
public decimal Price { get; private set; }
}BaseEntity<TKey>
For a custom key type, override the abstract Id property:
csharp
using Gryd.Domain.Primitives;
public sealed class Order(string id) : BaseEntity<string>
{
public override string Id { get; protected set; } = id;
}