I’d like to return an object with the following signature
class AnonClass{ string Name {get;} IEnumerable<Group> Groups {get;} }
I have tried the following query, but g only returns a single entity, not all the joined entities
var q = from t in dc.Themes join g in dc.Groups on t.K equals g.ThemeK select new {t.Name, Groups = g}; return q.ToArray();
but this returns
class AnonClass{ string Name {get;} Group Groups{get;} }
What is the correct linq query to use?
I think you want ‘join into’ instead of just ‘join’:
(That’s completely untested, however – worth a try, but please verify carefully!)