首先创建代码,从多到多,并在关联表中添加其他字段
public class Member{ public int MemberID { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public virtual ICollection<Comment> Comments { get; set; }}public class Comment{ public int CommentID { get; set; } public string Message { get; set; } public virtual ICollection<Member> Members { get; set; }}public class MemberComment{ public int MemberID { get; set; } public int CommentID { get; set; } public int Something { get; set; } public string SomethingElse { get; set; }}