title: How does one use a custom property in a LINQ-to-Entities query?
body: <p>I have a class <code>Post</code> which is an <a href="https://en.wikipedia.org/wiki/Entity_Framework" rel="noreferrer">Entity Framework</a> model. It contains a property like this:</p>
  
  <pre><code>public bool Showable {
    get {
      return this.Public &amp;&amp; this.PublishedDate &gt; DateTime.now
    }
  }
  </code></pre>
  
  <p>I can use it in a query like this:</p>
  
  <pre><code>from p in db.Posts where p.Showable select p;
  </code></pre>
  
  <p>but when I have a property that uses it, like this</p>
  
  <pre><code>public IEnumerable&lt;Post&gt; ShowablePosts {
    get {
      return from p in db.Posts where p.Showable select p;
    }
  }
  </code></pre>
  
  <p>then I can't do:</p>
  
  <pre><code>from p in ShowablePosts where p.Id &gt; 42 select p;
  </code></pre>
  
  <p>It says:</p>
  
  <blockquote>
    <p>The specified type member 'Showable' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.</p>
  </blockquote>