conditional include in linq to entities?

后端 未结 5 2190
孤街浪徒
孤街浪徒 2020-11-29 07:30

I felt like the following should be possible I\'m just not sure what approach to take.

What I\'d like to do is use the include method to shape my results, ie define

5条回答
  •  温柔的废话
    2020-11-29 08:19

    Am I missing something, or aren't you just looking for the Any keyword?

    var query = dealerships.Where(d => d.parts.Any(p => p.price < 100.00) || 
                                  d.parts.suppliers.Any(s => s.country == "brazil"));
    

提交回复
热议问题