键和非键之间的一对一关系 Visual Studio 2010 图
您好,我有这两个表:
Client:
-IdClient: primary key
-Name
-IdAccount
Account:
-IdAccount: primary key
-Total
我使用 Client 表中的 IdAccount 和 Account 表中的 IdAccount 创建一对一关系。我读到在 Visual Studio 中只能在键之间完成一对一的关系,在本例中是 IdClient-IdAccount,如何与 IdAccount 和 IdAccount 建立一对一的关系?如果我做了一个,它就会变成一对多=S
谢谢!
Hi I have these two tables:
Client:
-IdClient: primary key
-Name
-IdAccount
Account:
-IdAccount: primary key
-Total
I one to create a 1 to 1 relationship using IdAccount from Client table and IdAccount from Account table. I read that onley 1 to 1 relationships can be done in Visual studio between keys, in this case IdClient-IdAccount, how can I make a one to one relationship with IdAccount and IdAccount? If I make one it does it as 1 to many =S
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个问题几乎涵盖了整个问题(我认为这就是你想要的)已读过)。在这种情况下,对象关系模型定义一对多关系,因为实际数据模型(即数据库)允许一对多使用。
如果您确实有特殊需要(考虑到将来您可能希望允许单个客户拥有单独的帐户,就像银行的正常情况一样,因此保留一对多的关系可能是一个好主意)可以摆弄端点的多重性。
This question pretty much covers this entire issue (I reckon that's what you have read). Object relational models define one to many relationships in such cases because the actual data model (i.e. the database) allows one to many usage.
If you really have a special need (consider that in the future you might want to allow a single client to have separate accounts as is the normal case in a bank, so leaving the relationship one-to-many may be a good idea) you can fiddle with endpoint multiplicities.