'How Implement CRQS in DDD

If someone tries to implement the CQRS pattern without repository in DDD, in which layer should it be done? Infrastructure or Application Layer?



Solution 1:[1]

If you mean the implementation of the handlers of the queries and commands, it's done in the application layer.

But you need a repository to abstract the technological implementation outside of use cases/interactors (application layer).

The Infrastructure layer is responsible for encapsulating technology. You can find there the implementations of database repositories for storing/retrieving business entities, message brokers to emit messages/events, I/O services to access external resources, framework related code and any other code that represents a replaceable detail for the architecture.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jackmekiss