领域驱动设计问题
我想询问一个推荐的解决方案: 我们有一份比赛清单。 每场比赛都有明确的参赛者必须支付的费用 我们有参与者 我必须知道参加比赛的参赛者是否已支付费用。 我正在考虑两种解决方案,问题是它必须是领域驱动设计中最合适的解决方案。 首先是在竞赛中创建字典而不是列表,字典的类型为
谢谢
I would like to ask for a reccomended solution for this:
We have a list of Competitions.
Each competition has defined fee that a participatior has to pay
We have Participators
I have to know has a Participator that is on a Competition paid the fee or not. I am thinking about 2 solutions and the thing is it has to be the most appropriate solution in Domain Driven Design.
First is to create a Dictionary in Competition instead of a List, the dictionary would have be of type <Participator, bool>.
The secont is perhaps create a different class that has 2 fields, a participator and feePaid. And in Competiton I would have a list of object of that new class.
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
听起来像是典型的多对多关系。 我将使用 Entry 关联类对其进行建模,如下所示:
sounds like a typical many to many relationship. i would model it with an Entry association class as follows:
我处理这个问题的方法是举办竞赛、参与者和注册。 参赛者将注册参加比赛,创建一个注册。 注册将包含竞赛 ID、参与者 ID、指示是否支付费用的标志以及任何其他注册特定数据(例如注册日期)。 这将在数据库中建模为“连接表”(带有附加数据)。 在应用程序方面,参与者将有一个注册列表,每个注册都会有一个关联的参与者和一场比赛。 同样,每个比赛都会有一个注册列表。
The way I would handle this is to have Competitions, Participants, and Registrations. A Participant would register for a Competition, creating a Registration. A Registration would consist of the Competition id, Participant id, a flag indicating whether the fee was paid or not, and any other registration-specific data (like the date of registration). This would be modeled in the database as a "join table" (with the additional data). On the app side, a Participant would have a list of Registrations, each Registration would have an associated Participant and a Competition. Likewise, each Competition would have a list of Registrations.