我有两个类,Group类与User类有多对多关系(表示用户所属的组),然后该组与用户类(表示组的所有者)之间也存在一对多的关系).
我该如何映射?
public class User
{
public int Id { get; set; }
public string Avatar { get; set; }
public string Name { get; set; }
public string Message { get; set; }
public virtual ICollection<Group> OwnedGroups { get; set; }
public virtual ICollection<Group> Groups { get; set; }
}
public class Group
{
public int Id { get; set; }
public DateTime CreateDate { get; set; }
public DateTime ModifyDate { get; set; }
public string Name { …Run Code Online (Sandbox Code Playgroud) c# mapping entity-relationship ef-code-first entity-framework-4.1