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

前端 未结 3 1118
北恋
北恋 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条回答
  •  时光说笑
    2020-12-09 22:54

    I also tried the second option it worked for me. I did like the parent->child relationship happening at an object level first and save to db. Maybe I should just remove all the relationships between the entities that EF generates and manually control this myself.

提交回复
热议问题