值对象与实体
简单的问题......当处理像电子邮件地址这样的东西时,直接的想法是将其视为一个值对象。
但是,如果我们有多个实体(例如客户、联系人和供应商)引用相同的电子邮件地址,则可以想象,当我们更改客户的电子邮件地址时,我们可能需要客户的联系人,并且他们可能是供应商也应将电子邮件更改反映到这些实体中。我是否正确地认为这给出了电子邮件地址身份,因此它现在应该表示为一个实体?
干杯,
史蒂夫
Quick question... When approaching something like an email address the immediate idea is to treat this as a value object.
If we have a number of entities though, say a customer, a contact, and a supplier that are referencing the same email address, it is conceivable that when we change a customer's email address we may want the customer's contact, and they may be a supplier too, have that email change reflected with those entities as well. Am I correct in thinking this is giving the email address identity so it should now be represented as an entity?
Cheers,
Steve
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,我相信你的做法是正确的。请参阅我之前的回答此处。
Yes, I believe you're on the right lines. See my previous answer here.