I use Entity Framework v4 (code-only). If I do
var result = from person in context.People.Include("Cars")
select new { person, person.Houses.Count, bar, foo, etc };
then result.First().Cars is null. If I do this way, it works, but I need Houses.Count:
var result = from person in context.People.Include("Cars")
select person;
It seems Entity Framework v4 doesn’t work well with object initializers?
The solution for now is this:
var result = from person in context.People.Include("Cars").Include("Houses")
select person;
But performance is ridiculous, I need to bring House row!
http://connect.microsoft.com/VisualStudio/feedback/details/527749/join-bug-at-ef4-code-only