我正在尝试获取用户具有与特定channelId匹配的报告的行计数。我尝试过没有运气的lambda表达式。
int count =
_reportsRepository.
GetMany(r => r.UserId == user.Id &&
(r.Charts.Any(cr => cr.Channels.Any(ch => ch.Id == channel.Id))).Any()).Count();
答案 0 :(得分:1)
怎么样?
int count = _reportsRepository.Where(
r => r.UserId == user.Id &&
r.User.Channels.Any(c => c.Id == channel.Id)).Count();