Assuming I have an Entity Framework 4.2 class like this:
class Company
{
public int ID { get; set; }
public ICollection<Employee> Employees { get; set; }
}
And I have collection like this:
public ICollection<Company> Companies { get; set; }
What's an efficient way to build a list of all employees in the entire Companies
collection? I do not need to worry about duplicates.
Note: I'm trying to do it without an Entity Framework context--just using the Companies
collection. However, if this entails a huge performance hit, I could get a context if necessary.