Search for existing suggestions

Allow Include() and Projections to Co-Exist

If you use a projection in the select part of a query, any eager loading of data through the use of Include() in the main query is ignored... as explained here http://social.msdn.microsoft.com/forums/en-US/adodotnetentityframework/thread/d700becd-fb4e-40cd-a334-9b129344edc9/

This is short sighted. I like Include() because I can dynamically append them to a query, the work around of putting the data to be "Included" in the projection does not allow for this dynamic extension oof the query.

If a developer has explicitly stated they wish to Include some related data they are doing it for a reason, so it should be respected.respected that they are doing so for

4 votes
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)

We’ll send you updates on this idea

Piers shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

This is supported in EF Core, however Include() will still be ignored if the projection does not project (as a property or the whole projection) the starting type of the Include(). It is very hard to imagine what we would do to implement a design in which Include() and the projection don’t need to be related at all.

1 comment

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...
  • Anonymous commented  ·   ·  Flag as inappropriate

    I agree! The current state of the Include extension method seems to be broken and unfinished. It is also missing the filter option.

Feedback and Knowledge Base