我正在尝试使以下内容起作用:
_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
)。