开发者

Linq.Where( List.Contains(Value) ) does not work on Entities

开发者 https://www.devze.com 2023-03-07 08:31 出处:网络
Code snippet var list = (from item in entitySet.Clients.AsQueryable() where listOfId.Contains(item.ID.ToString())

Code snippet

var list = 
(from item in entitySet.Clients.AsQueryable()
where listOfId.Contains(item.ID.ToString())
select item).ToList();

Error Message

LINQ to Enti开发者_如何学编程ties does not recognize the method 'Boolean Contains(System.String)' method, and this method cannot be translated into a store expression

Any solution to this ?


Try this:

var list = 
(from item in entitySet.Clients
join id in listOfId on item.ID equals id
select item).ToList();
0

精彩评论

暂无评论...
验证码 换一张
取 消