求教 求教

兔子家族-二哥 2017-08-10 11:34:45
var list = from a in LinqDBContext.UerCheckList
from b in LinqDBContext.UserCheckContent
from c in LinqDBContext.UserCheckProjectContent
from f in LinqDBContext.firesystype

where a.UserCheckId == UserCheckId && a.orgid == b.orgid && b.ProjectId == c.ProjectId && c.tiSysType == f.tiSysType
select new
{
a.UserCheckId,
b.ProjectId,
f.vSysdesc,
c.ProjectContent,
Info = from e in LinqDBContext.UserCheckInfo where e.UserCheckId == a.UserCheckId && e.ProjectId == b.ProjectId select new { e.FaultShow, e.Handingimmediately, e.UserCheckResult, e.YnHanding, PicUrl = from q in LinqDBContext.UserCheckPic where q.UserCheckId == a.UserCheckId && q.ProjectId == e.ProjectId select URL + q.PicPath }
};
var query = from q in list
group q by q.vSysdesc into g
select new
{
vSysdesc = g.Key,
UserCheckInfos = g
};

这是一个正常且逻辑正确得Linq写法,只是我们要转Json出集合,现在想要去掉 Info ,直接将Info下面得值提到和a.UserCheckId,b.ProjectId, f.vSysdesc,c.ProjectContent,同一级 如何做啊?
...全文
169 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
引用 1 楼 q107770540 的回复:
var list = from a in LinqDBContext.UerCheckList from b in LinqDBContext.UserCheckContent from c in LinqDBContext.UserCheckProjectContent from f in LinqDBContext.firesystype from e in LinqDBContext.UserCheckInfo from q in LinqDBContext.UserCheckPic where a.UserCheckId == UserCheckId && a.orgid == b.orgid && b.ProjectId == c.ProjectId && c.tiSysType == f.tiSysType where e.UserCheckId == a.UserCheckId && e.ProjectId == b.ProjectId where q.UserCheckId == a.UserCheckId && q.ProjectId == e.ProjectId select new { a.UserCheckId, b.ProjectId, f.vSysdesc, c.ProjectContent, e.FaultShow, e.Handingimmediately, e.UserCheckResult, e.YnHanding, PicUrl = URL + q.PicPath };
督查好久没见
q107770540 2017-08-11
  • 打赏
  • 举报
回复
var list = from a in LinqDBContext.UerCheckList from b in LinqDBContext.UserCheckContent from c in LinqDBContext.UserCheckProjectContent from f in LinqDBContext.firesystype from e in LinqDBContext.UserCheckInfo from q in LinqDBContext.UserCheckPic where a.UserCheckId == UserCheckId && a.orgid == b.orgid && b.ProjectId == c.ProjectId && c.tiSysType == f.tiSysType where e.UserCheckId == a.UserCheckId && e.ProjectId == b.ProjectId where q.UserCheckId == a.UserCheckId && q.ProjectId == e.ProjectId select new { a.UserCheckId, b.ProjectId, f.vSysdesc, c.ProjectContent, e.FaultShow, e.Handingimmediately, e.UserCheckResult, e.YnHanding, PicUrl = URL + q.PicPath };

8,497

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 LINQ
社区管理员
  • LINQ
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧