Bug Tracker Architecture
I am creating a Bug Tracker application (toy one) with DDD in mind. I have a BugRepository with methods like Add / Delete / Save and a user Repository having the same kind of methods (Actually both derive from IRepository). Now Bug has a Property called "Assigned To" which is a column in DB where the ID of the user is stored.
Now I need a method called "FindAssignee" or rather I want to know who the bug is assigned to. Where do i put that?
I was thinking that I could say --> In BugRepository add a method called "FindAssignee". But that would return a "USER" object. Is that OK? Aren't repositories for an aggre开发者_JS百科gate root (Bug this case) supposed to return ONLY their entities (Bug again) ?
Is that OK?
Yes.
Aren't repositories for an aggregate root (Bug this case) supposed to return ONLY their entities (Bug again) ?
Yes.
But your query isn't to a aggregate root.
Your query is against a specific Bug which has one or more Assignees.
精彩评论