最佳答案
我正在努力让下面这些东西发挥作用:
_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();
导致例外的部分是:
.Include(x => x.Children.OrderBy(y => y.Order).ToList())
编辑:
经过进一步观察,
_dbmsParentSections.ForEach(x => x.Children = x.Children.OrderBy(y => y.Order).ToList());
为我完成了这项工作(在最初的 Factory
呼叫之后,没有 Children.OrderBy
)。