Entity Framework Update Entity along with child entities (add/update as necessary)

后端 未结 3 1491
一个人的身影
一个人的身影 2021-02-02 15:24

I have a many-to-many relationship between Issues and Scopes in my EF Context. In ASP.NET MVC, I bring up an Edit form that allows the user to edit a

3条回答
  •  一个人的身影
    2021-02-02 16:25

    Warning, this is just from the top of my head, I didn't try it.

    I don't think you can set a foreign key just like you do with ProjectID.

    you need to retrieve the project and add it to the scope.Project navigation property. EF will take care of the relations when you insert it.

    Now again, I didn't try and might be wrong, but worth a try. Maybe this helps getting you on the way..

提交回复
热议问题