View Single Post
  #2 (permalink)  
Old July 4th, 2015, 04:05 AM
nick_t nick_t is offline
Wrox Author
Points: 237, Level: 4
Points: 237, Level: 4 Points: 237, Level: 4 Points: 237, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: May 2015
Posts: 59
Thanks: 1
Thanked 5 Times in 5 Posts


Glad to have you back :)

Repositories are a tricky subject to be fair. Should repository interfaces live in the domain or service layer? It depends.

For me, I would try and keep repositories completely out of the domain. I think that's the ideal, because they are an implementation detail. However, sometimes you need to run queries as part of your domain logic. And so, you almost have to have a repository in the domain so it can be called from within a domain service.

If you ask a handful of DDD practitioners, even those talking at conferences etc, I would expect some will say repositories in the domain, others will say keep them out.

Basically, my opinion is, if you can keep them out... keep them out. If not, don't be afraid to put them in the domain model.
Reply With Quote