I've switched a relationship in a model from one to many to many to many and its effecting how the ObjectQuery.Include method is eager loading objects from the database.
An example Module before adding a many to many looks like:
Company -(1..*)-> Cars -(1..*)-> Passengers
Company -(1..*)-> Passengers
A simple query such as:
company = context.Company.Include("Cars").Include("Passengers").First(e => e.CompanyId = companyId);
both populates all the passengers under the company, but also all the passengers under the cars. I.e. company.Cars[0].Passengers is populated.
But when the model is changed to:
Company -(1..*)-> Cars -(*..*)-> Passengers
Company -(1..*)-> Passengers
performing the same query doesn't populate the passengers under the cars.
Adding an additional Include("Cars.Passengers") corrects this.
I initially thought this was a bug, but it makes complete sense when you realise that before the entity framework had enough information to construct the graph. It will query all cars and passengers associated with the company, and each passenger row/object references the car it belonged to, therefor it can assign passengers to cars.
With a many to many relationship added there is an additional link table that will not query unless told to. Without the relationship between cars and passengers the framework cannot reconstruct the graph.