title: How to generate an AND with a grouped OR query, with LINQ?
body: <p>I'm struggling to understand how to come up with a query like the following, using LINQ ...</p>
  
  <pre><code>SELECT *
  FROM foo
  WHERE a = false AND (b = true OR c = true)
  </code></pre>
  
  <p>I'm using Entity Framework and LINQ to query my database. I've got a table and entity class that has some boolean columns, and looks like so ...</p>
  
  <pre><code>public class Foo
  {
    public bool A { get; set; }
    public bool B { get; set; }
    public bool C { get; set; }
  }
  
  var foos = DbSet&lt;Foo&gt;();
  </code></pre>
  
  <p>I'm trying to write a query that will select these records in such a way that if I want to include columns that are true, they need to be OR'd together, not AND'd. For the properties that are not true, though, they need to exist as ANDs.</p>
  
  <p>I'm sure this is something very basic but I'm just failing to see the simple solution. Specifically, I cannot figure out how to progressively add the OR clauses.</p>
  
  <p>Edit:</p>
  
  <p>To clarify my logic, I'll explain what I'm trying to make happen. I'm trying to write a filter query that would allow me to ask the database, "show me all Foos where either A is true, or B is true and C is not true". Or maybe the query would need to ask, "show me all Foos where C is true and A and B are not true".</p>
  
  <p>This is a query to be used as part of an ASP.NET action method, filtering based on some check boxes. So, the action method knows whether A, B or C need to be filtered as true or false, I just need to write a LINQ expression that builds this query.</p>