Re: Repositories Global only or contextual?
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <[email protected]> |
I rarely do specific repositories for aggregates, since repository which I consume accepts specification for querying. To me this makes much more sense since specifications are part of the domain while repository interface which matches those specifications is just an implementation detail. I'm yet to read IDDD (it's sitting here on the shelf), so I can't comment on mr. Vaughn's suggestion. But basically, yeah, you should rarely expose Set member to all aggregates, it's much better to have specific methods which return a collection of aggregate subset. If you consider repository interface to be a part of your application instead of part of your domain (as I do), then it's a must to have infrastructure dependent implementation. In my experience any other decision will lead to performance issues - if your application is non-trivial with lots of data. Regards, Rikard