Hi,

I have a problem with a query in entity farmework (I'm using EF 3.1.18).
When I add an OrderBy in ThenInclude, I've got a crash :


An expression of type 'System.Linq.IOrderedQueryable`1 [GenericGui.WPF.Model.Program.Parameter]' cannot be used for a return type 'System.Linq.IOrderedEnumerable`1 [GenericGui.WPF.Model.Program .Parameter] '

Can someone explain to me why it does'nt work?

Here is my code :


Code:
            using (GenericGuiDbContext context = _contextFactory.CreateDbContext())
            {
                Program entity = await context.Programs
                    .Include(a => a.DeltasList)
                    .Include(a => a.ProgramLine).ThenInclude(b => b.Function)
                    .Include(a => a.ProgramLine).ThenInclude(b => b.Condition)
                    .Include(a => a.ProgramLine).ThenInclude(b => b.Params.OrderBy(p => p.Id))
                    .Include(a => a.ProgramLine).ThenInclude(b => b.Trigger)
                    .Include(a => a.AxisList).ThenInclude(b => b.AxisSoft)
                    .Include(a => a.AxisList).ThenInclude(b => b.AxisType)
                    .FirstOrDefaultAsync((e) => e.Id == id);
                entity.ProgramLine = entity.ProgramLine.OrderBy(c => c.LineNumber).ToList(); // pour trier les lignes de programme dans l'ordre
                CurrentWorkingProgram = entity;
                return entity;