2
public static IEnumerable<AppCache> GetTopRatedApps(string language,bool isinitialized)
{
List<AppCache> objApps = new List<AppCache>();
objApps = GetAllApps(isinitialized,language).ToList();
List<RatingCache> objRatings = new List<RatingCache>();
objRatings = GetAllRatings();
var query =
from Apps in objApps
join ratings in objRatings
on Apps.AppId equals ratings.AppId where ratings.RatingGiven == 1
select new AppCache();
return query;
}
存儲過程:轉換存儲過程LINQ查詢
select o.AppId, count(*) as ItemCount
from App o
inner join Rating od
on o.AppId = od.AppId
where od.RatingGiven = 1
group by o.AppId
無法弄清楚如何獲得該項目從列表中計數。
不是:應用程序緩存相當於應用
是否'group'幫助http://msdn.microsoft.com/en-us/library/bb545971.aspx – Harrison
也,看看LINQ做了一些樣本分組:HTTP://code.msdn。 microsoft.com/LINQ-to-DataSets-Grouping-c62703ea – GolfWolf
這裏是一個帖子,顯示你正在尋找什麼http://stackoverflow.com/a/10047966/2145211 – Harrison