在sql反模式中,提到了闭包表,它只有两个字段。

public class Tree

{

/// <summary>
/// 祖先
/// </summary>
public int Ancestor { get; set; }

/// <summary>
/// 子孙
/// </summary>
public int Descendant { get; set; }

/// <summary>
/// 层级
/// </summary>
public int PathLength { get; set; }

/// <summary>
/// 顺序同级
/// </summary>
public int PathOrder { get; set; }

/// <summary>
/// 父级
/// </summary>
public int ParentId { get; set; }

}

增加的字段的作用。

PathLength 当前的结点在一棵树的层数。

ParentId 当前的结点的血亲父级。有利于画树。

 

相关文章:

  • 2021-08-03
  • 2022-12-23
  • 2021-06-04
  • 2021-06-24
  • 2021-11-28
  • 2021-08-04
  • 2021-10-20
  • 2021-09-23
猜你喜欢
  • 2022-01-14
  • 2022-01-13
  • 2021-09-01
  • 2022-01-05
  • 2021-10-23
  • 2021-06-13
  • 2021-11-06
相关资源
相似解决方案