[英]EF 6 - Recursive Many to Many relationship
In my domain i have the concept of a Group
and User
. 在我的领域中,我具有
Group
和User
的概念。 A User
is a Guid
,login and password, and a Group
is composed by a Guid
,Title and a List of "members". User
是Guid
登录名和密码,而Group
是由Guid
,标题和“成员”列表组成的。 The members of a given group can be both Users
and others Groups
. 给定组的成员既可以是
Users
组,也可以是其他Groups
。 How do model this scenario in EF 6 using code-first? 如何使用代码优先在EF 6中对此场景建模?
Create a base class which both User
and Group
extend (maybe containing only the [Key]
attribute) and use it. 创建一个
User
和Group
可以扩展的基类(可能仅包含[Key]
属性)并使用它。 EF will create 3 tables and handle the joins... EF将创建3个表并处理联接...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.