我试图得到类似如下的工作:实体框架订购包括
_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
之后)。
感谢您提供找到了我工作藏汉 – Ronan 2016-08-31 14:42:09