0
嗨我想获得这个linq查询的计数。我使用实体框架与存储库模式。 可能通过queryUserWalls.ToList()。Count() 得到结果,我认为这是低效的。 任何身体都可以帮忙。用连接和联合计数查询
var queryUserWalls = (from participation in _eventParticipationRepository.GetAll()
join eve in _eventRepository.GetAll() on participation.EventId equals eve.Id
join userWall in _userWallRepository.GetAll() on participation.EventId equals userWall.EventId
where participation.UserId == userId
select userWall.Id)
.Union(from userWall in _userWallRepository.GetAll()
select userWall.Id);
为什么不能直接执行'.Count()'? (no'.ToList()') – xanatos
为什么你不能调用'queryUserWalls.Count()'? – MarcinJuraszek