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
| Measure | Verified total |
|---|---|
| Domain-event records | 6 |
| Domain-event base types | 1 (AssetDomainEventBase) |
| Shared payload records | 1 (AssetLifecycleData) |
| Domain events raised but unmapped | 0 |
Aggregate base exposing DomainEvents | 1 (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 event | Raised on transition | Holder captured in snapshot |
|---|---|---|
AssetRequestedDomainEvent | Asset request created (Requested) | Requester (CompatId may be 0 at create) |
AssetAssignedDomainEvent | Asset issued to a holder (Issued) | New assignee |
AssetReturnedDomainEvent | Issued asset returned (Returned) | Previous holder |
AssetRejectedDomainEvent | Pending request rejected (Rejected) | Requester at rejection |
AssetLostOrDamagedDomainEvent | Asset flagged lost or damaged | Holder at the time of the event |
AssetRetiredDomainEvent | Asset 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.csmicroservices/src/asset-service/Domain/Asset/Asset.csmicroservices/src/asset-service/Domain/Common/DomainPrimitives.cs
Related Articles
See Also
Keywords
- Domain events
- Aggregate root
- Lifecycle snapshot
Revision Information
- Status: Draft
- Last reviewed: 2026-07-17
- Review cycle: Quarterly