有谁有单向多对多关系的现实例子吗?
似乎多对多关系应该始终是双向的,因为每一方可能都对访问另一方的集合感兴趣。 有没有人有一个现实世界的例子,其中多对多关系是单向的。
It seems that a many to many relationship should always be bidirectional since each side is probably interested in accessing the other side's collection.
Does anyone have a real world example where a many to many relationship made sense being unidirectional.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一个简单的示例,
您可能希望将产品分组/组织到通用集合中,并允许最终用户创建新集合。
一些集合用于在网站上显示产品,其他集合用于管理(人员 A 负责...,人员 B 负责其他产品),
某些产品保留在“缺货”集合中,其他产品保留在“需要更新”集合中,等等...
在这种情况下,您很可能总是希望使用特定集合检索产品。
如果您需要产品所属的所有集合,那么您始终可以为此编写一个函数。
A simple example,
You may want to group/organise products in generic collections and allow the end user to create new collections.
Some collections are used to display products on a website, others are used for administration (person A is responsible for... , person B for other products),
some products are keps in a 'out of stock' collection, others in a 'need to be updated' collection, etc...
In such a scenario you will most likely always want to retrieve a products using a specific collection.
And if you need all the collections a product belongs to, then you can always write a function for that.