Table of Contents

Interface IReconstitutionStampable

Namespace
Trellis
Assembly
Trellis.Core.dll

Infrastructure seam that lets a non-EF persistence adapter restore a reconstituted aggregate's persistence-managed metadata — audit timestamps and the optimistic-concurrency token — and clear its uncommitted domain events in one infra-only call.

public interface IReconstitutionStampable
Extension Methods

Remarks

Reconstitution rebuilds an aggregate from already-persisted, known-good state without running its Create/TryCreate factory — no invariant re-validation, no new identity, and no creation events. The aggregate author owns rebuilding the domain state: expose a Reconstitute(...) factory that calls the (private) constructor and assigns get-only properties and private child collections directly. This seam restores only the infrastructure metadata — the audit timestamps and the concurrency token — and clears any uncommitted domain events.

Aggregate<TId> implements this interface explicitly, so the method stays off the aggregate's domain surface and is reachable only by a persistence adapter that casts to IReconstitutionStampable. The Trellis EF Core integration performs the equivalent through its materializer and interceptors.

Typical adapter usage:

// The author's factory rebuilds domain state (private ctor + child collections); the adapter then
// restores the infrastructure metadata it loaded from storage.
var order = Order.Reconstitute(row.Id, row.CustomerId, row.Status, lineRows);
((IReconstitutionStampable)order).StampReconstitutedState(row.CreatedAt, row.LastModified, row.ETag);
return order;

Methods

StampReconstitutedState(DateTimeOffset, DateTimeOffset, string)

Restores the persistence-managed metadata of a reconstituted aggregate — the audit timestamps and the optimistic-concurrency token — and clears any uncommitted domain events so the aggregate represents already-persisted state. With the default event-based change tracking the aggregate then reports IsChanged as false. For persistence infrastructure only — not domain code.

void StampReconstitutedState(DateTimeOffset createdAt, DateTimeOffset lastModified, string etag)

Parameters

createdAt DateTimeOffset

The stored creation timestamp.

lastModified DateTimeOffset

The stored last-modified timestamp.

etag string

The stored optimistic-concurrency token. Must be a valid unquoted RFC 9110 §8.8.1 opaque tag (see StampETag(string)).

Exceptions

ArgumentNullException

etag is null.

ArgumentException

etag is empty, whitespace, or contains characters that are not valid in an RFC 9110 opaque tag.