How to do a SQL “Where Exists” in LINQ to Entities?

前端 未结 2 916
难免孤独
难免孤独 2020-12-14 07:18

I really want to do something like this:

Select * 
from A join B on A.key = B.key join C on B.key = C.key -- propagated keys
where exists (select null from B         


        
相关标签:
2条回答
  • 2020-12-14 07:49

    Have you tried adding your exists conditioning to your joins?

    from a in context.AEntity
    Join B in context.BEntity on A.Key equals B.Key && B.Name == "Joe"
    Join C in context.CEntity on B.Key equals C.Key && C.Name == "Kim";
    

    Not sure if that will work, but worth a shot.

    0 讨论(0)
  • 2020-12-14 07:59

    The .Any() extension method typically maps to exists.

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