linq join小于或等于int值

时间:2012-02-08 10:19:16

标签: linq entity-framework linq-to-entities where

我想知道where子句的最佳方法是否小于或等于匹配值为int的地方?

var outOfStockProducts = (from theMapProd in context.tblProductOptions_MAP
                          join theProd in context.tblProducts on theMapProd.productID equals theProd.productID
                          where theProd.stock_Level  <= 5
                          select theMapProd).ToList();

1 个答案:

答案 0 :(得分:0)

这是另一种方式, 未经测试。

var outOfStockProducts = (from theMapProd in context.tblProductOptions_MAP
                      join theProd in context.tblProducts on theMapProd.productID equals theProd.productID
                      select theMapProd).ToList();

outOfStockProducts=outOfStockProducts.where(x=>x.stock_Level  < 5 || x.stock_Level ==5).ToList();