Skip to content

v5.0.0

Choose a tag to compare

@github-actions github-actions released this 24 Jul 19:56
· 11 commits to main since this release

v5.0.0 — the tactical DDD release

The domain layer stops being a bag of base classes with an Id and becomes the set of blocks a DDD model actually needs. Persistence gains the seam that stores those blocks without letting the domain leak into it.

🧩 Domain — the tactical blocks

Pure domain types. They know nothing about persistence, and nothing about your database.

  • ValueObject — structural equality from the components you declare. Two Money(10, "USD") are the same value; a Money is never equal to a Weight with the same number.
  • AggregateRoot<TKey> — the consistency boundary and the source of domain events, built on eQuantic.Core.DomainEvents. It raises events, exposes them, and is identified by its key.
  • EntityBase<TKey> — now compares by identity: same type + same non-default key means the same entity. An entity whose key is still the default is transient and compares by reference, because it has no identity yet.
public sealed class Order : AggregateRoot<Guid>
{
    public static Order Place(Guid id, string customer)
    {
        var order = new Order(id, customer);
        order.RaiseDomainEvent(new OrderPlaced(id));
        return order;
    }
}

🔌 Persistence — the seam, without the leak

The domain and the DataModel stay separate types with a mapper between them: IDomainEntity belongs to the domain, IEntity to the DataModel, and neither borrows the other's contract.

  • AggregateRepository<TAggregate, TData, TKey> maps an aggregate to its DataModel with eQuantic.Mapper and hands the DataModel to the repository. Your application code speaks Order; storage only ever sees OrderData.
  • DomainUnitOfWork drains the written aggregates' domain events into the outbox in the same transaction as the write — the aggregate and its events commit together, or neither does. No event is lost to a crash between "saved" and "published".
  • Audit conventions resolve the acting user from IApplicationContext, so CreatedById/UpdatedById/DeletedById are stamped alongside the timestamps.
await orders.AddAsync(Order.Place(id, "acme"));   // domain in
await unitOfWork.CommitAsync();                   // DataModel + its events, one transaction

🔎 Application — the query string reaches the store typed

PagedListRequest<T>.ToQueryOptions() and .ToPageRequest() turn a bound HTTP request — filterBy=total:gt(100)&orderBy=total:desc — into the query options the engine executes. Both sides are built on eQuantic.Linq, so the filter compiles to the same predicate and the sorts pass straight through.


⚠️ Breaking change

EntityBase<TKey> now compares by identity instead of by reference. Sets, dictionaries and Distinct() treat two instances carrying the same key as one entity. If your code relied on reference equality for entities — deduplicating by instance, or keying a dictionary by object identity — that behaviour changes silently. Review those spots before upgrading.


Full changelog: v4.0.0...v5.0.0