日期:2014-05-17  浏览次数:20912 次

ef怎么查询制定列表中的所有id
var ids = new List<int>{1,2,3,4};    
    var his = from h in ctx.hisotry
                      where h.ID in ids
                      select h;

where 语句怎么写啊.. 不然只能遍历ids查询了。。。  求指点。。。。

------解决方案--------------------
var ids = new List<int>{1,2,3,4};    
    var his = from h in ctx.hisotry
                      where ids.Contains(h.ID)
                      select h;