Part of DKNet.EfCore.Abstractions. Use Entity<TKey> for an identity plus event queues, or implement the covariant IEntity<out TKey> contract yourself.
Use the console-project setup in the Quick Start, then replace Program.cs with this example.
using DKNet.EfCore.Abstractions.Entities;
var item = new Product(7, "Coffee");
Console.WriteLine(item); // Product '7'
public sealed class Product(int id, string name) : Entity<int>(id)
{
public string Name { get; } = name;
}
![Product supplies its integer ID to Entity
Entity specializes Entity<Guid>. Parameterless construction leaves Id at its CLR default; supplying an ID calls the protected base constructor. No key is generated by this package.
Id has a private setter in the base class; establish it through construction or persistence configuration.[IgnoreEntity] is a class marker, but the current automatic model configuration does not inspect it. Use explicit model configuration when excluding a type.