I dont seem to be able to find any evidence of multiple groupby being supported in LinqToSQl on the internet (I should probably buy a book :))
I'd like to be able to do this:
var qry = from s in DBContext.Styles
join artist in DBContext.Artists on s.ID equals artist.StyleID
join track in DBContext.Tracks on s.ID equals track.StyleID
group artist by new { s.ID, s.Name } into a
group track by new { s.ID, s.Name } into t
select new DTO.StyleSummary
{
ID = a.Key.ID,
Name = a.Key.Name,
NumberOfArtists = a.Count(),
NumberOfTracks = t.Count()
};
However the 2nd group statement prevents compilation.. Since this is possible in native sql how can I do this??
Thoughts? Is this even possible?