Select IN SQL in Linq or EntityFramework

0

in a system I get a list like that

l_res2 = contexto.Ventas.Where(x => in_obj.FechaFin >= x.FechaInicio  && 
in_obj.FechaInicio <= x.FechaFin ).OrderBy(x => x.FechaFin).ToList();

Now, I have a table Sales_States IdSaleId IdSell IdState DateChangeState , what I need is to do that same query but only the sales whose IdVenta of the Sales table, is in the table Sales_States. In pure SQL I would solve it more or less like this:

Select * from ventas ven where IdVenta in (Select IdVenta from 
Ventas_Estados ve_est where ven.IdVenta=ve_est.IdVEnta )

Finally, how can I do this with Linq or directly with the collections of EntityFramework, and I also ask if they know of any link listing the common queries in sql and their corresponding in linq or Entity. Thanks

    
asked by Lucho 04.07.2018 в 19:22
source

0 answers