“Select NOT IN” clause in Linq to Entities

后端 未结 1 606
旧巷少年郎
旧巷少年郎 2020-12-30 01:38

Is there a way to use the \"NOT IN (select XXX...)\" clause in Linq to Entities?
All the questions I found were regarding a list of objects (IN (1,2,3)) but I want to ge

1条回答
  •  無奈伤痛
    2020-12-30 02:05

    Like this:

    from c in db.Customers
    where !db.Products.Any(p => p.ProductID == c.ProductID)
    select c;
    

    0 讨论(0)
提交回复
热议问题