Entity Framework: adding existing child POCO to new Parent POCO, creates new child in DB

前端 未结 3 1204
北恋
北恋 2020-12-09 22:33

Im wanting to use Entity Framework POCO in a disconnected (from context) mode. In my scenario I\'m creating a new Parent object and want to attach an existing child object

3条回答
  •  萌比男神i
    2020-12-09 22:55

    Entity Framework does not allow relationships that cross contexts.

    If you place the reading of the course and connecting the course to the student within the same using statement, it would work.

提交回复
热议问题