Repository-interfaces: Domain Layer or Application Layer?
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <CAKqMafwjJSZKV+-j2wC8On0u_6jOMggysmFYedYc5K3C4M8uBw@mail.gmail.com> |
Long I have been following the advise of most articles, books and forums to make the repository-interfaces part of the Domain Layer. As many have asked in the past, 'Are repositories part of your Domain Model or not?', the answer usually was 'their interfaces - yes, their implementations- no.' Which, IMHO implied that you should put the repository-interfaces into your Domain Model assembly (aka the Domain Layer). However, my experience is that those interfaces are never actually used inside your Domain Layer - the first layer that actually uses them is the Application Layer. Isn't it then much more sane to define them in that layer? Perhaps you have always been doing it that way, or is there any evidence is it still best to keep them close(r) to your Domain Model instead?