Closed songjt123 closed 3 years ago
var query = Db.Find(); var result = query.Where(x => x.Status == (int)noticeStatus.已发布); var joinQuery = query.LeftJoin((x, y) => x.CreatedBy == y.Id).LeftJoin((x,y,z) => y.Id == z.Id) .Select((x, y, z) => new { x, ModuleName = z.Name, Creator = y.Name });
result 查询结果只显示x表的数据,ModuleName 、Creator不在结果集。
测试admin源码file模块中的联查没有问题,此代码不在admin模块中
需要在实体中包含同名的属性,或者在实体的扩展属性中添加
了解了了解了,也就是说只能给主表赋值
var query = Db.Find(); var result = query.Where(x => x.Status == (int)noticeStatus.已发布); var joinQuery = query.LeftJoin((x, y) => x.CreatedBy == y.Id).LeftJoin((x,y,z) => y.Id == z.Id)
.Select((x, y, z) => new { x, ModuleName = z.Name, Creator = y.Name });
result 查询结果只显示x表的数据,ModuleName 、Creator不在结果集。
测试admin源码file模块中的联查没有问题,此代码不在admin模块中