Given a POCO model and Code First, after setting a foreign key property on an instance that has an associated navigation property, fix-up is supposed to occur during DetectChanges. If code causes another navigation property to be lazy-loaded on that instance then the fix-up does not occur.
This appears to be a bug in DetectChanges. From what I can tell this issue exists in all versions of EF since 4.1.
The attached solution demonstrates the problem.
This appears to be a bug in DetectChanges. From what I can tell this issue exists in all versions of EF since 4.1.
The attached solution demonstrates the problem.