开发者

How to use IN operator in Linq?

Query:

Select * from pu_Products 
    where Part_Number in ('031832','027861', '028020', '033378') 
    and User_Id = 50 and Is_Deleted = 0

The above mentioned query is in SQL and i need the query might be converted into Linq. Is there any option using t开发者_Python百科he "IN" operator in Linq?. can you convert above mentioned query into Linq?


dbContext.Products
    .Where(p => (new string[] {"031832","027861","028020","033378"})
        .Contains(p.Part_Number) && p.Is_Deleted == false);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜