I am trying to find something like the following:
_dbmsParentSections = FactoryTools.Factory.PdfSections .Include(x => x.Children.OrderBy(y => y.Order).ToList()) .Include(x => x.Hint).Include(x => x.Fields) .Where(x => x.FormId == FormId && x.Parent == null) .OrderBy(o => o.Order) .ToList();
The part that throws the exception:
.Include(x => x.Children.OrderBy(y => y.Order).ToList())
EDIT:
After further observation
_dbmsParentSections.ForEach(x => x.Children = x.Children.OrderBy(y => y.Order).ToList());
did this job for me (after the initial Factory call and without Children.OrderBy ).
c # linq entity-framework-5 entity-framework
Serj sagan
source share