2013-08-30 59 views
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; 

有人可以幫助我這裏發生了什麼,我真的不知道這個查詢發生了什麼。它總是會給我一個錯誤:*結果視圖=類型'<> f__AnonymousType1'存在於'KoolHealth.Server.dll'和'System.Web.dll'*Linq查詢與組通過收益率沒有結果

第一個匿名查詢它會給我的結果,但在第二個與小組的,它不會。

+1

看起來你並沒有顯示所有代碼? –

+0

這裏同樣的問題。你知道爲什麼會發生這種情況嗎? –

回答

0

請試試這個:

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