Skip to content

Query: correlated collection optimization doesn't get applied for subqueries with AsQueryable #12195

@maumar

Description

@maumar

Currently we only apply correlated collection optimization of the subquery doesn't have any result operators. We should allow AsQueryable, for cases like this:

var query = ctx.LevelOne.Select(l1 => new 
{ 
    l1.Id, 
    Collection = l1.OneToMany_Optional.AsQueryable().Include(l2 => l2.OneToOne_Required_FK).ToList() 
});

i.e. to apply include on a collection when the source qsre is not projected directly (#12181 has more details)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions