3
I have a case where I need to bring all the items of the parent object where you have a certain condition, example:
ctx.Pai
    .Where(x=> x.Ativo == true)
    .Include(Filhos)
    .Where(TrazerApenasFilhosAtivos);
I tried to use with Any, but looking at SQL it creates an Exists and that’s not what I wanted, I wanted to bring active father and all his children also active.
How to do?
You want him to just return the children and not the father, right?
– Filipe Oliveira
Tries
.Include(Filhos.Where(condicao));– Jéf Bueno
If what you want is a kind of
Left Join, withLambdausingIncludeis not possible. Maybe your solution is withLinq(from p in context.Pai ...) orGroupJoinwithLambda.– JamesTK
Groupjoin (Left Join) example: https://www.youtube.com/watch?v=4JspxnEAE-M
– JamesTK
Another example of Left Join, but
Linq: https://www.youtube.com/watch?v=ksGHiGg405M– JamesTK