linq查询转化为查询表达式

fyrise fyrise 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
现有表department,外键MatchID,表Team,外键DepID,表Player外键TeamID,要求以MatchID为参数查询Team,和Player,在下列查询中如何写
public IQueryable<Team> loadSearchData(TeamQuery team)
{
//知道DepID
if (DepID> 0)
{
temp = temp.Where<Team>(u => u.DepID== DepID);
}
if(MatchID>0){
//linq写法为
// from s in departmentwhere s.MatchID==MatchID
// from t in Team where t.DepID==s.DepID
// select t

//这儿如何写?依据MatchID查询department,依据查询出来的department表的DepID来查询得到Team表

temp = temp.Where<Team>(u=> 如何写 )
}
}

第二问:
依据MatchID查询department,依据查询出来的department表的DepID来查询得到Team表,依据查询出来的Team表的TeamID来查询Player
//linq写法为
// from s in departmentwhere s.MatchID==MatchID
// from t in Team where t.DepID==s.DepID
// from p in Player where p.TeamID==t.TeamID
// select p

//这儿如何写?

temp = temp.Where<Player>(u=> 如何写 )
}
}





...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
fyrise
LINQ 8,492 成员 4,736 内容