orm的几种排序写法
第一种:有局限性,只能使用主表的Rpl_WorkFlow里的字段排序
var list = LepulsDB.DBContext.Rpl_WorkFlow.Select()
.Join(McDB.Com_Structure, (t, f) => t.Com_StructureID == f.Com_StructureID)
.Where(m => m.Com_StructureID != Guid.Empty)
.OrderBy(m=>m.sort)//sort是Rpl_WorkFlow表的字段
.ToList();
第二种:比较好,可以使用关联表里的字段排序
OrderByClip clicp = new OrderByClip("DisplayOrder");//DisplayOrder是Com_Structure表的字段
OrderByClip clicp2 = new OrderByClip("Com_StructureID");
OrderByClip clicp3 = new OrderByClip("sort");//sort是Rpl_WorkFlow表的字段
var list = LepulsDB.DBContext.Rpl_WorkFlow.Select()
.Join(McDB.Com_Structure, (t, f) => t.Com_StructureID == f.Com_StructureID)
.Where(m => m.Com_StructureID != Guid.Empty)
.OrderBy(clicp, clicp2, clicp3).ToList();