错误追踪架构
我正在创建一个 Bug Tracker 应用程序(玩具一),并考虑到 DDD。我有一个包含添加/删除/保存等方法的 BugRepository 和一个具有相同类型方法的用户存储库(实际上两者都派生自 IRepository)。现在 Bug 有一个名为“分配给”的属性,它是数据库中存储用户 ID 的列。
现在我需要一个名为“FindAssignee”的方法,或者更确切地说我想知道错误被分配给谁。我把它放在哪里?
我想我可以说——>在 BugRepository 中添加一个名为“FindAssignee”的方法。但这会返回一个“USER”对象。可以吗?聚合根的存储库(这个例子是错误)不应该只返回它们的实体(再次是错误)吗?
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 aggregate root (Bug this case) supposed to return ONLY their entities (Bug again) ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的。
是的。
但您的查询不是针对聚合根。
您的查询针对的是具有一个或多个受让人的特定 Bug。
Yes.
Yes.
But your query isn't to a aggregate root.
Your query is against a specific Bug which has one or more Assignees.