Let's say I have a three-level hierarchy of entities like this Continent -> Country -> City.
I'm currently using code-first to generate the database.
I have a List of Continent entities, each continent entity having a List of Countries, each country having having a list of Cities.
All entites have a Deleted boolean property.
Using dbContext, how can I retrieve all non-deleted items from the database in this same structure, ie, in the end I'll just have a List of continents (higher level).
Since all entities are related, when I do
var allContinents = context.Continents.ToList();
I get a list of all entities I have, but I don't know how to do a good-looking LINQ statement to filter by my Deleted property.
What I am doing right know is bring everything into memory and remove the deleted items, but I don't want to bring useless data.
Any help is appreciated. Thanks