Select where in in LINQ

1

How to convert the code select down into LINQ?

select * from producao
where id not in
(select idProducao from bpi)
    
asked by anonymous 17.02.2017 / 14:45

2 answers

2
producao.Where(p=>!bpi.Select(p=>p.idProducao).ToList().Contains(id))
    
17.02.2017 / 14:51
3

You can do this:

db.Producao.Where(p => !db.Bpi.Select(b => b.idProducao).Contains(c.Id));

I placed it on GitHub for future reference .

    
17.02.2017 / 14:59