title: Using flags attribute in data access layer to generate bitwise SQL query
body: <p>I have a function in my data access layer. This function takes an enum (which has <code>[Flags]</code> attribute on it) as its only parameter. </p>
  
  <pre><code>[Flags]
  public enum ItemTags { Browsable = 2, InMenu = 4 }
  
  public List&lt;Item&gt; GetAllItems(ItemTags flags)
  {
      // Here I should create the SQL bitwise query.
  }
  </code></pre>
  
  <p>In this function, I should create a bitwise SQL query, something like:</p>
  
  <pre><code>select * from tableName where columnName &amp; 2 = 2 and columnName &amp; 4 = 4
  </code></pre>
  
  <p>And in my business layer, I want to use that function. But there are many possible ways to use those tags and flags. Some of these functions could be:</p>
  
  <pre><code>public List&lt;Item&gt; GetItemsOfMenu()
  {
     return repository.GetAllItems(ItemTags.InMenu);
  }
  
  public List&lt;Item&gt; GetBrowsableItems()
  {
     return repository.GetAllItems(ItemTags.Browsable);
  }
  
  public List&lt;Item&gt; GetBrowsableMenuItems()
  {
     return repository.GetAllItems(ItemTags.Browsable &amp; ItemTags.InMenu);
  }
  </code></pre>
  
  <p>How can I do that?</p>