8000 Raise Domain Events from Entities (Clean Architecture, DDD) · Issue #431 · endatix/endatix · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Raise Domain Events from Entities (Clean Architecture, DDD) #431
@PeterMarinov

Description

@PeterMarinov

Description

Raise domain events directly from domain entities, following Clean Architecture and Domain-Driven Design (DDD) principles. Avoid raising events in the business logic of CQRS Handlers; instead, ensure that entities themselves are responsible for emitting events when their state changes.

Scope

  • Implement domain events for key state transitions, such as IsComplete and IsChanging (e.g., FormUpdatingEvent, FormUpdatedEvent).
  • Leverage MediatRDomainEventDispatcher as infrastructure to dispatch events, and consider how EF Core can be used to process these events in a centralized and consistent manner.
  • Ensure that event raising is encapsulated within the domain model, not in application or handler logic.

References

Acceptance Criteria

  • Domain events are raised from entities, not from CQRS handlers.
  • State transitions like IsComplete and IsChanging are covered by events.
  • Event dispatching is handled centrally using infrastructure (e.g., MediatR, EF Core hooks).
  • Code is clean, maintainable, and follows SOLID and DDD best practices.

Metadata

Metadata

Assignees

No one assigned

    Labels

    📐 architectureNeeds a review to agree on approach. It's a substantial change of great concerndev-experienceImproves the developer experience & productivitytech-debtTechnical debt. Addressing this will address known issue or opportunity to improve the codebase

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0