Select * from pu_Products
where Part_Number in ('031832','027861', '028020', '033378')
and User_Id = 50 and Is_Deleted = 0
上面提到的查询是在SQL中我需要将查询转换为Linq。在Linq中有没有使用“IN”运算符的选项?你能将上面提到的查询转换成Linq吗?
答案 0 :(得分:4)
dbContext.Products
.Where(p => (new string[] {"031832","027861","028020","033378"})
.Contains(p.Part_Number) && p.Is_Deleted == false);