Linq 和 EF Contains示例

List<int> unitIDList=new List<int>();

//此处添加int元素

var query = DB.ElecConsumers.Where(c => unitIDList.Contains(c.ParentUnitID));

//EF方式

var query1 = (from c in DB.ElecConsumers where unitIDList.Contains(c.ParentUnitID ) select c);

//Linq方式

posted @ 2016-04-16 08:50  zhaogaojian  阅读(1332)  评论(0编辑  收藏  举报