I have two entities, say, "Car and Photography." Each photo has a foreign car key, so each car has its own photos.
I want to list some subsets of cars, and for each listed car I want to list all the photos.
How to do this in Entity Framework with 1 db request? From the very beginning, I know that I need photographs.
Now my code is as follows:
var carList = CarEntities.Where(...).ToList(); foreach(var car in carList){ var photoList = car.Photos.ToList(); }
I think EF will make a separate db request for each car.
source share