I have entity framework setup and I have the following relationships setup:
- AdListing (AdListingID, Title, Details)
- AdListingLocation ( An AdListing can have multiple locations: AdListingID, LocationID)
- Location (LocationID, Country, City)
In EF I would like to return all AdListings where the City is “New York”
Keep in mind I would also like to load the AdListingLocation relationship (along with some others). In another post I learned I am not allowed to do manual joins if I am using .Include. How can I accomplish both?
var results = (from a in db.AdListings.Include("AdListingPhotos").Include("AdListingLocations")
where a.AdListingLocations.Location.City = "New York"
select a).ToList();
To get the lambda syntax on Include just put this line: