我对使用 linq 2 实体的查询之一有疑问。我试图在查询生成到数据库之前查看查询,但没有任何成功。我尝试使用 ToTraceString() 但无法导致无法将查询转换为 ObjectQuery。这是我的查询:
var movies = (from m in watchedRepo.GetAll().Where(c => c.iUserId == userId).ToList()
join f in moviePageViewsRepository.GetAll() on m.iMovieId equals f.iMovieId
group f by new JoinClass { MovieId = f.iMovieId, Points = m.iPoints }
into g
orderby g.Key.Points descending , g.Sum(d => d.iScore) descending
select new JoinClass { MovieId = g.Key.MovieId, Points = g.Key.Points, PageViews = g.Sum(d => d.iScore) }).Skip(skip).Take(take);
如果我尝试从 linq 执行它,则会出现内存不足异常。请问有什么想法吗?