Skip to content

Query: Select.Include.OrderBy ignores the include #10101

Closed

Description

@smitpatel
                    var query2 = context.Set<OrderLine9912>()
                        .Select(o => o.Order)
                        .Include(o => o.Customer)
                        .OrderBy(o => o.Id)
                        .ToList();

If OrderBy is present, we ignore the include, if it is absent then we do include correctly

Activity

  1. added this to the 2.1.0 milestone on Oct 18, 2017
  2. modified the milestones: , 2.1.0 on Jan 17, 2018
  3. maumar commented on Feb 14, 2018

    @maumar
    Contributor

    workaround is to apply Include after the order by

  4. added 5 commits that reference this issue on Feb 15, 2018
  5. maumar commented on Feb 16, 2018

    @maumar
    Contributor

    fixed by d527800

  6. added 3 commits that reference this issue on Feb 24, 2018
  7. MarcelChirtes commented on Apr 18, 2019

    @MarcelChirtes

    Something strange happens to me, at first run (request) warning is there, then everything is silent, EF core 2.2.3, contextLifetime and optionsLifetime are scoped, the warning reapers one time once app is restarted.

  8. ajcvickers commented on Apr 18, 2019

    @ajcvickers
    Contributor

    @MarcelChirtes This is expected. The query compiles once, at which time you see the warning, and is then cached for future calls.

  9. MarcelChirtes commented on Apr 19, 2019

    @MarcelChirtes

    @ajcvickers fair point, I assume there's no way to suppress it? Thank you.

  10. ajcvickers commented on Apr 19, 2019

    @ajcvickers
    Contributor

    @MarcelChirtes Any warning can be suppressed using ConfigureWarnings in the DbContextOptionsBuilder provided by AddDbContext or OnConfiguring.

  11. modified the milestones: , 2.1.0 on Nov 11, 2019
  12. added theissue type on Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions