开发者

How to write an "OR" within a Linq to Sql .Where()

开发者 https://www.devze.com 2023-01-02 17:36 出处:网络
I want to get all records WHER开发者_StackOverflowE (s.override == 1 OR (s.override == 2 AND s.approved == 1))

I want to get all records WHER开发者_StackOverflowE (s.override == 1 OR (s.override == 2 AND s.approved == 1))

How can I do that using the .Where x.subcontracts.Where(s ==> ??)


Use standard C# binary operators:

x.subcontracts
  .Where(s => s.override == 1 || (s.override == 2 && s.approved == 1))


Here is the where clause you need:

x.subcontracts.Where(s => (s.override == 1) || (s.override == 2 && s.approved == 1))
0

精彩评论

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