Let's say I have some table named foo
and I want to filter out some rows based on a list of id
's.
var idsList = new List<int> { 1, 4, ..., 9999 }
I can't use contains statement due to performance issues with query plan pollution context.Foos.Where(x => idsList.Contains(x.Id))
so I'm trying to solve this with advanced linq like:
from a in context.Foos
join b in idsList on a.Id equals b
select a;
or
from a in context.Foos
from b in idsList
where a.Id == b
select a;
but that does not translate.
I'm aiming to produce join between Foos and temp table of id's.