I have these classes:
public class RegionResult
{
public string Region { get; set; }
public List<Unicorn> Unicorns { get; set; }
}
public class Unicorn
{
public string Name { get; set; }
public string Color { get; set; }
public Dictionary<string, string> Parameters { get; set; }
}
And I would assign data to a List from my datacontext. "Flat" query would look like:
SELECT * FROM Regions R
JOIN Unicorns U ON R.X = U.X
LEFT JOIN Parameters P ON U.X = P.X
I would like to have it grouped by region, and for each region populate with unicorns, and parameters if not null. How would that query look like?
List<RegionResult> regions = (from a in (_entites.Regions).AsEnumerable().GroupBy(...)
.select new... a = a.Unicorn.Name.. new .ToDictionary(key, value)?
Thanks in advance
/Lasse