I am using EF 7.0.0-rc1-final.
The following statement generates multiple queries on the server. Is this normal or I am missing something ?
Group myGroup = dbContext_ .Set<Group>() .Include(x => x.GroupRoles) .ThenInclude(x => x.Role) .FirstOrDefault(x => x.Name == "Approver");
I see two separate queries executed on the server:
It's a standard many-to-many scenario. Why is the first query ?
Yes, itâ€™s normal even in one to many scenarios.
EF7 generates multiple queries to avoid returning the same data multiple times.
Here is a great post about EF6 Include to understand why this change was required for EF7: Entity Framework pitfalls, include