客户与个人/组织之间的聚合关系

发布于 2024-09-29 16:12:19 字数 590 浏览 5 评论 0原文

我有一个 Client 对象,其中包含 Person 对象或 Organization 对象。这些Person对象或Organization对象可能与独立于Client对象的其他对象有关系。在这种情况下,我应该在 Client -> > 之间使用通用聚合关联吗?人员客户->组织,其中客户端对象是整体。

另请注意这些场景:

  1. 在某些场景中,可能是一个普通的代表客户付款(*组织*)
  2. 可能是客户产品
  3. 可能是供应商

I have a Client object which will either have a Person object or Organization object in it. These Person objects or Organization objects might have relations to other objects independent of the Client object. In this case should I use a General Aggregation association between Client -> Person and Client -> Organization where the Client object is the whole.

Also note these scenarios:

  1. Person might be a normal Person in some scenarios like; Person makes payment on behalf of Client(*Organization*)
  2. Person might be a Client which bought a Product from Us.
  3. Person might be a Supplier

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

没有伤那来痛 2024-10-06 16:12:19

虽然您确实没有提供足够的信息,但听起来您正在描述一个典型的角色类模型

我怀疑您的客户实际上并没有拥有个人或组织,而是该个人或组织客户,或IOW,无论是个人还是组织在某种关系中可以扮演客户的角色。

有多种方法可以对此进行建模,但没有单一正确的解决方案。您可能会发现这篇文章很有帮助

While you really didn't provide enough information, it sounds like you're describing a typical Role Class Model.

I suspect that your Client doesn't really have a Person or an Organization, but rather that Person or an Organization is a Client, or IOW, either a Person or an Organization can play a role of a Client in a certain relationship.

There are various ways to model this, and no single correct solution. You might find this article helpful

转角预定愛 2024-10-06 16:12:19

不要忘记两个关联之间的异或约束(因为客户端不能同时连接到个人和组织)

don´t forget an xor constraint between both associations (since a client cannot be connected to both a person and a organization)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文