开发者

LINQ to Entities does not recognize the method

LINQ to Entities does not recognize the method 'Boolean Contains(Int32)' method, and this method cannot be translated into a store expression.

    var开发者_JS百科 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;

which is a solution for this problem?


You can do it in a single query:

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;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜