title: Fluent Nhibernate expression to select on flagged enum
body: <p>I have a domain entity that has a flagged enum as a property.  The flagged enum is the target audience for the these entities.  The user then has a flagged enum value of the entities they should see. I am trying to figure out the correct expression to select entities that meet the target audience for the user.</p>
  
  <pre><code>public class File
  {
      public virtual TargetAudience TargetAudience { get; set; }
  }
  
  [Flags]
  public enum TargetAudience
  {
      Audience1 = 1,
      Audience2 = 2,
      Audience3 = 4,
      Audience4 = 8
  }
  </code></pre>
  
  <p>Expression: (This works when performed on a <code>IList&lt;File&gt;</code>, but doesn't work on a query to the database.)</p>
  
  <pre><code>public Expression&lt;Func&lt;File, bool&gt;&gt; Expression
  {
       get { return ((x.TargetAudience &amp; UserTargetedAudience) &gt; 0); }
  }
  </code></pre>
  
  <p>Any suggestions would be helpful.</p>