Create code first, many to many, with additional fields in association table

前端 未结 6 1670
星月不相逢
星月不相逢 2020-11-21 10:21

I have this scenario:

public class Member
{
    public int MemberID { get; set; }

    public string FirstName { get; set; }
    public string LastName { get         


        
6条回答
  •  北荒
    北荒 (楼主)
    2020-11-21 10:38

    One way to solve this error is to put the ForeignKey attribute on top of the property you want as a foreign key and add the navigation property.

    Note: In the ForeignKey attribute, between parentheses and double quotes, place the name of the class referred to in this way.

    enter image description here

提交回复
热议问题