Given the following classes:
public class Nation { public string Name { get; set; } public IEnumerable<City> Cities { get; private set; } } public class City { public string Name { get; set; } }
Suppose Nation is the aggregate root, and so I only have NationRepository , not a CityRepository (so Nation is the starting point for Linq queries). To clarify, the starting point will be an IQueryable<Nation> object.
How to write a query that returns a collection of City objects according to the following logic:
Select all instances of City whose Name begins with 'M', whose parent Nation name is 'UK'?
David source share