Not loading the object caused EF4 (code first) to remove the relationship
- by Lavinski
Firstly this is a EF4: Code First - Property Loading question.
I'm loading an object like so
var item = Context.Table.Find( update.Identifier );
This object has a property Relationship so a table has a Relationship object.
Now i'm updating my item but my Relationship object is not toched (and therefore not lazy loaded).
Now here's the problem ..
I save my item and my relationship to the Relationship object is deleted, apparently the model thinks i set it to null. However it all works if I look at the property before saving.
So I'm looking into LoadProperty or doing a query and using Include.
Has anyone else come across this issue and how did you get around it?