No orderby in LINQ query, but ORDER BY in SQL

106 Views Asked by At

I have a LinqToEntities query that does not use an orderby clause, but on the resulting SQL query, there is an ORDER BY clause (which costs 77% on the query on execution plan).

Does anyone know why the ORDER BY clause is added and how can I remove it (if possible) ?

Here is the LinqToEntities query :

var classementsQuery =
    from classement in _dbContext.Classements
                                 .Include(c => c.Operations)
                                 .Include("Operations.Matrices")
                                 .Include("Operations.Qualifications")
                                 .Include("Operations.Qualifications.Matrices")
                                 .Include("Operations.Qualifications.QualificationEtapes")
                                 .Include("Operations.Qualifications.QualificationEtapes.Matrices")
    where classement.Operations.Any()
    select classement;

Nota : each of the included entities relations are n-n.

0

There are 0 best solutions below