Entity Framework references not loading automatically

ado.net, c#, entity-framework

Solution

Using ADO.NET Entities, you need to specify what entities you want to load automatically with `Include`, as in

Dim entity = (From e in db.Entities.Include("SubEntity"))

Problem

In the ADO.Net Entity Framework, I have an object which has 4 references to other objects. For some reason, when I query those references, two of them load automatically (as expected), and two of them always return null. Bizarrely enough, when I manually ask the references to load, they load just dandy. As an example: ``` if (account.HoldingEntity == null && account.HoldingEntityReference.EntityKey != null) { account.HoldingEntityReference.Load(); account.HoldingEntity = account.HoldingEntityReference.Value; } ``` When I first check the `HoldingEntity` it is always null, however the Load will return the HoldingEntity without problem. Any clues? Thanks!

Original source