Entity Framework will only set related entity property to “null” if I first get the property

前端 未结 6 980
难免孤独
难免孤独 2021-01-14 00:50

Edit This seems to occur for any Entity property that references another entity in one direction. In other words, for the below example, the fact

6条回答
  •  野的像风
    2021-01-14 01:15

    You are right - this happens beacause you used lazy loading in EF (virtual property). You may remove virtual (but this may be impossible for you). Other way you described in your question - call property, and set this to null.

    Also you could read another topic about this problem on SO.

提交回复
热议问题