LINQ to Entities无法识别方法'Boolean Contains(Int32)'方法,并且此方法无法转换为商店表达式。
var warranty_yes = from i in devicesEntities.device
where i.WarrantyDate >= DateTime.Now
select i.Id;
var warranty_yes_list = warranty_yes.ToList();
var view_query = from i in devprim_by_status
where warranty_yes_list.Contains(i.Id)
select i;
这是解决这个问题的方法吗?
答案 0 :(得分:3)
您可以在一个查询中执行此操作:
var view_query =
from i in devprim_by_status
join d in deviceEntities.device on i.Id equals d.Id
where d.WarrantyDate >= DateTime.Now
select i;