对于一般的目录树,通常就是一对多的自反关系,一般会有一个PID,引用于这个ID,实体类代码类似于下:
class Catalog
{
public Catalog()
{
this.References = new List<Reference>();
this.Children = new List<Catalog>();
}
public string CatalogID { get; set; }
public string CatalogName { get; set; }
public string CatalogPID { get; set; }
public ICollection<Reference> References { get; set; }
public virtual Catalog Parent { get; set; }
public virtual ICollection<Catalog> Children { get; set; }
}