【发布时间】:2012-05-16 03:34:25
【问题描述】:
我正在使用ORM that uses POCOs。
每个表(类)都包含对其他表的引用。
public class Table1 {
[AutoIncrement]
public Int32 Id { get; set; }
[Index(Unique = true)]
public string FieldA { get; set; }
}
public Table2 {
[AutoIncrement]
public Int32 Id { get; set; }
[Index(Unique = true)]
public Table1 FieldA { get; set; }
public int FieldB { get; set; }
}
public Table3 {
[AutoIncrement]
public Int32 Id { get; set; }
[Index(Unique = true)]
public List<Table2> FieldA { get; set; }
[References(typeof(Table2))]
public int Table2_id { get; set; }
}
如何填充 Table3 的树,它将引用的 Table2 和后续的 Table1 展开到子树中?
感谢所有建议
【问题讨论】:
-
刚刚意识到 C# 没有我认为理所当然的内置数据结构。幸运的是 C5 添加了这么多必需的功能集。
标签: c# data-structures reference tree recursive-datastructures