I've got two tables that looks like this:
-- Houses
houseid personid
1 11
1 12
1 13
2 232
2 5533
2 40
-- People
personid person name
11 John
12 Jane
13 Zoe
and a class
class House
{
List<string> people_name {get; set;};
}
And I want to return an object House that contains a List on all the people's names that live in a given house. The closest I got to achieving it was returning an IQueryable in the object House, because you cannot call ToList from within a query:
LINQ to Entities does not recognize the method 'System.Collections.Generic.List`1[System.String]
ToList[String](System.Collections.Generic.IEnumerable`1[System.String])'
method, and this method cannot be translated into a store expression.