Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • 1
    The point of the repository is to decouple app from persistence and there's no complexity involved. And I change the persistence details at least once, because the db access is the last thing I code, until that point I'm using in memory repos. Besides, there is a very subtle trap when you're using a persistence detail directly. Your business objects will tend to be designed to be compatible with it, instead of agnostic. And that's because a rich, properly encapsulated entity can't be directly restored from any storage (except memory) without (some ugly) workarounds Commented May 6, 2014 at 13:50
  • About adding a new way to query an aggregate root or any entity, that's why CQRS appeared. Personally, I keep the Repository for domain purposes and use query handlers for actual querying. And those handlers are very tightly coupled to the db and ofc very efficient at what they do. Commented May 6, 2014 at 13:53