Mapping many to many relationship

后端 未结 2 885
春和景丽
春和景丽 2021-01-22 05:00

I am have some trouble getting Entity Framework to handle a many to many relationship in my data schema. Here is my model:

public class User
{
    public int Us         


        
2条回答
  •  死守一世寂寞
    2021-01-22 05:37

    Instead of trying to map this as many to many, map it as two one to many relationships. See the discussion of many to many join tables with payload in Many-to-Many Relationships in this tutorial:

    http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/creating-a-more-complex-data-model-for-an-asp-net-mvc-application

提交回复
热议问题