【发布时间】:2014-10-08 14:27:01
【问题描述】:
我有一个名为 Parent 的实体,其中包含子列表。 现在我想按显示顺序选择一个父级及其所有子级。
entities:- class parent{
Int id;
List<Child> children;
}
class Child{
String name;
DateTime DOB;
Int DisplayOrder;
}
之前我使用 Linq to Entity 从数据库获取父级
context.Parents.Find(id);
这一切都很好。但现在我的要求发生了变化,现在我需要按显示顺序选择其子顺序。我怎样才能做到这一点。任何帮助表示赞赏。
更新父类:-
class parent{
public Int id;
public virtual List<Child> children;
}
【问题讨论】:
标签: asp.net linq c#-4.0 entity-framework-6.1