简体   繁体   English

EF 6-递归多对多关系

[英]EF 6 - Recursive Many to Many relationship

In my domain i have the concept of a Group and User . 在我的领域中,我具有GroupUser的概念。 A User is a Guid ,login and password, and a Group is composed by a Guid ,Title and a List of "members". UserGuid登录名和密码,而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. 创建一个UserGroup可以扩展的基类(可能仅包含[Key]属性)并使用它。 EF will create 3 tables and handle the joins... EF将创建3个表并处理联接...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM