Skip to main content

Asset Domain Events

Summary

Unlike some earlier modules, Asset Management defines a real domain-event abstraction. The Asset aggregate raises six typed domain events during lifecycle transitions; each carries a uniform lifecycle snapshot.

Audience

Engineering, integration, QA, architecture, security, and product reviewers.

Reference Content

Verified totals

MeasureVerified total
Domain-event records6
Domain-event base types1 (AssetDomainEventBase)
Shared payload records1 (AssetLifecycleData)
Domain events raised but unmapped0
Aggregate base exposing DomainEvents1 (AggregateRoot)

The abstraction

AggregateRoot exposes a read-only DomainEvents collection with Raise(...) and ClearDomainEvents(). IDomainEvent defines EventId and OccurredAtUtc. AssetDomainEventBase implements IDomainEvent, stamping a new EventId (GUID) and OccurredAtUtc at construction.

The six events

Domain eventRaised on transitionHolder captured in snapshot
AssetRequestedDomainEventAsset request created (Requested)Requester (CompatId may be 0 at create)
AssetAssignedDomainEventAsset issued to a holder (Issued)New assignee
AssetReturnedDomainEventIssued asset returned (Returned)Previous holder
AssetRejectedDomainEventPending request rejected (Rejected)Requester at rejection
AssetLostOrDamagedDomainEventAsset flagged lost or damagedHolder at the time of the event
AssetRetiredDomainEventAsset retired from service (Retired)Holder, if any

The lost and damaged transitions both raise AssetLostOrDamagedDomainEvent; the specific outcome is distinguished by the Status and Condition fields in the snapshot.

The uniform snapshot

Every event carries AssetLifecycleData: TenantId, TenantKey, AssetId (GUID), CompatId (numeric), AssetCode, AssetName, AssetType, AssignedToUserId, LaborId, Status, Condition, Notes, and ReturnDueDate. For a return, loss, or damage, the holder captured is the previous holder, recorded before the assignee is cleared.

Lifecycle, not persistence

Domain events are cleared after they are dispatched to the outbox on save; the DomainEvents collection is EF-ignored and never persisted. See Publishing and outbox.

Source References

  • microservices/src/asset-service/Domain/Asset/AssetDomainEvents.cs
  • microservices/src/asset-service/Domain/Asset/Asset.cs
  • microservices/src/asset-service/Domain/Common/DomainPrimitives.cs

See Also

Keywords

  • Domain events
  • Aggregate root
  • Lifecycle snapshot

Revision Information

  • Status: Draft
  • Last reviewed: 2026-07-17
  • Review cycle: Quarterly