244
CHAPTER 6 | Tackle Business Complexity in a Microservice with DDD and CQRS Patterns
For instance,
Jimmy Bogard, when providing direct feedback for this guide, said the following:
This’ll probably be my biggest feedback. I’m really not a
fan of repositories, mainly because they hide
the important details of the underlying persistence mechanism. It’s why I go for MediatR for
commands, too. I can use the full
power of the persistence layer, and push all that domain behavior
into my aggregate roots. I don’t usually want to mock my repositories –
I still need to have that
integration test with the real thing. Going CQRS meant that we didn’t really have a need for
repositories any more.
Repositories might be useful, but they are not critical for your DDD
design in the way that the
Aggregate pattern and a rich domain model are. Therefore, use the Repository
pattern or not, as you
see fit.
Additional resources
Repository pattern
•
Edward Hieatt and Rob Mee. Repository pattern.
https://martinfowler.com/eaaCatalog/repository.html
•
The Repository pattern
https://learn.microsoft.com/previous-versions/msp-n-p/ff649690(v=pandp.10)
•
Eric Evans. Domain-Driven Design: Tackling Complexity in the Heart of Software.
(Book;
includes a discussion of the Repository pattern)
https://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-
Software/dp/0321125215/
Unit of Work pattern
•
Dostları ilə paylaş: