0
I’m trying to make the following consultation sql, using the Entityframework:
select * from pedidos
where pedidoID not in (select pedidoID from agendamentos);
I conducted some research and discovered that the method of Entityframework replacing the not in
of sql is the Contains()
.
So I set up the following code:
var pedidos = Db.Pedidos.Where(x =>
Db.Pedidos.Where(y => y.PedidoId == x.Agendamentos.Select(z=>z.PedidoId).
FirstOrDefault()).Select(y => y.PedidoId).ToList().
Contains(
Db.Pedidos.Where(z=>z.PedidoId == x.PedidoId).
Select(y => y.PedidoId).FirstOrDefault())
).
ToPagedList(1, RecordsPerPage);
With the Contains method I get the following error:
I believe that being a requested timeout, the research sql is taking too long to run, so I tried to put conditions to decrease the size of the list, and even so I keep giving the same error.
So the function works perfectly:
If you can help me with this problem, I’d be grateful!
You have not changed the setting that sets the time of timeout?
– Jéf Bueno
I didn’t change it, it’s standard.
– João Pedro