Entity Framework 5 not updating navigation properties in both entities

Posted by Taylor on Stack Overflow See other posts from Stack Overflow or by Taylor
Published on 2012-09-19T03:29:34Z Indexed on 2012/09/19 3:37 UTC
Read the original article Hit count: 122

Filed under:
|
|

I have updated a project to use the new Entity framework shipped with VS2012, however I have run into some of my code throwing exceptions.

In the VS10 version of EF I was able to create or modify and Entity and use its navigation properties before calling SaveChanges()

For example: A Navigation property of a client having a collection of Invoices.

Client c = new Client();
Invoice I = new Invoice();
c.Invoices.Add(I);

I would then be able to use Invoice.Client somewhere in my code before actually saving it without issue. Now Invoice.Client == null.

Similarly in setting I.Client = C, I does not show up under C.Invoices

What am I missing here or is this just simply how EF5 is?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET