Intent.MediatR.DomainEvents
This module dispatches an application's domain events through MediatR and generates the handlers that react to them.
What it generates
DomainEventNotification<TDomainEvent>, a MediatRINotificationthat wraps a domain event, so that a domain event can be published without the Domain layer depending on MediatR.DomainEventService, the implementation ofIDomainEventServicethat publishes each domain event as aDomainEventNotification<T>.- Domain event handlers, one class for each Domain Event Handler modelled in the Services designer, with a
Handlemethod for each domain event it handles. Interactions modelled on a handler (calling a command, or creating or updating an entity) are implemented from the model. A handler with nothing modelled is a stub for you to write; mark itsHandlemethod[IntentManaged(Mode.Fully, Body = Mode.Ignore)]when you write its body. - Default domain event handlers, one for each domain event that no modelled handler handles, when Create implicit Domain Event Handlers is on.
{Entity}Managerclasses, one for each domain entity associated with domain events, implementingINotificationHandlerfor each of those events.mediatr-domain-event-handlerAI skill, which tells a coding agent how to write a domain event handler body.
Settings
| Setting | Effect |
|---|---|
| Domain Event Settings → Create implicit Domain Event Handlers | Generates a default handler for each domain event with no modelled handler. Turn it off to generate only the handlers you model. |
Related modules
Intent.DomainEventsprovides the domain event base types and theIDomainEventServiceinterface this module implements.Intent.Application.MediatRprovides the MediatR pipeline that commands sent from a handler run through.