日期:2014-05-20 浏览次数:21035 次
var query=from s in db.SubArea ......此处省略 select new{ ....//此处省略 Zhan = db.Customer.Where(c => (db.graveTemp.Where(g => g.subarea == s.Id).Select(g => g.gvid).Contains(c.FgrvId))) }; //提示错误错误 “System.Linq.IQueryable<int>”不包含“Contains”的定义,并且最佳扩展方法重载 “System.Linq.ParallelEnumerable.Contains<TSource>(System.Linq.ParallelQuery<TSource>, TSource)”的某些参数无效 F:\projects\TombPrj\TombDAL\GraveService.cs 346 60 TombDAL
var query=(from s in db.SubArea join g in db.graveTemp on g.subarea equals s.Id select g.gvid) .Count(gid => db.Customer.Any(c=>c.FgrvId==gid));
------解决方案--------------------
var query=from s in db.SubArea
......此处省略
select new{
....//此处省略
Zhan = from c in db.Customer
let subIds=db.graveTemp.Where(g => g.subarea == s.Id).Select(g => g.gvid)
where subIds.Contains(c.FgrvId)
select c;
};