【发布时间】:2016-10-20 10:27:37
【问题描述】:
我有两个表“CategoryGroup”和“Category”,它们在一个列表中返回数据。要求是将平面列表转换为层次列表,例如 CategoryGroup 包含相关类别。
请建议如何转换为层次结构列表?
public class ProfileConditionGroup
{
public Guid ConditionGroupGUID { get; set; }
public string ConditionGroupName { get; set; }
public List<ProfileConditionList> profileConditions { get; set; }
}
public class ProfileConditionList
{
public string ConditionName { get; set; }
public Nullable<Guid> ConditionGUID { get; set; }
public string[] ThisConditionSelectedByProfileIDs { get; set; }
public Nullable<Guid> ParentConditionGroupGUID { get; set; }
public bool IsDefaultSelected { get; set; }
}
【问题讨论】:
-
items.GroupBy(x => x.CategoryGroup)? -
请在 C# 中为这两个表提供类定义。
-
@Enigmativity : 更新后
标签: c# asp.net entity-framework entity-framework-6