0
IEnumerable<EFDBActivityActual> _tempList = 
    context.ActivityActual
           .Include(a => a.ExercisesActualList.Select(b => b.AerobicActual.IntensityFactor))
           .Include(a => a.ExercisesActualList.Select(b => b.ResistanceActual.IntensityFactor))
           .Include(a => a.ExercisesActualList.Select(b => b.ResistanceActual.ResistanceSetList))
           .Include(a => a.ActivityLocation)
           .Include(a => a.ActivityTemplate)
           .Where(a => a.QserID == session.UserID &&
                 (a.CreatedOn >= _fromDate && a.CreatedOn <= _toDate) &&
                 ((a.ExercisesActualList.Count() != 0) && a.StartTime != null));


var dx = from a in _tempList
             select new
             {
                 weeknumber = WeekNumber(a.CreatedOn),
                 activity = a
             };

    var g = from ax in dx
            group ax by ax.weeknumber
            into bx
            select bx;

有人可以帮助我这里发生了什么,我真的不知道这个查询发生了什么。它总是会给我一个错误: *Results View = The type '<>f__AnonymousType1' 同时存在于 'KoolHealth.Server.dll' 和 'System.Web.dll'*

第一个匿名查询它会给我结果,但在第二个带有 group by 的查询中,它不会。

4

1 回答 1

0

请试试这个:

var g = from ax in dx
        group ax by new { ax.weeknumber } into bx
        select new bx;
于 2013-08-30T02:46:10.977 回答