我有具有以下特征的菜单表:
tblMenu: ID , Title , ParentID , OrderM
我想使用 ParentID 和 OrderM 选择菜单和订单,如下所示:
前任:
表中数据:
ID = 1 Title = menu1 ParentID = 0 OrderM = 1
ID = 2 Title = menu2 ParentID = 0 OrderM = 2
ID = 3 Title = menu3 ParentID = 0 OrderM = 3
ID = 4 Title = submenu2-1 ParentID = 2 OrderM = 1
ID = 5 Title = submenu2-2 ParentID = 2 OrderM = 2
ID = 6 Title = submenu1-2 ParentID = 1 OrderM = 2
ID = 7 Title = submenu1-1 ParentID = 1 OrderM = 1
我想要选择 LINQ 的以下结果:
menu1
submenu1-1
submenu1-2
menu2
submenu2-1
submenu2-2
menu3