title: Inline delegate for Linq to Entities
body: <p>I have a feeling I already know the answer to this question.</p>
  
  <p>I have an expression that common but complex, and I would like to re-use the code in multiple locations.  I would like to use a function that returns a Func with some code:</p>
  
  <pre><code>public static Func&lt;MyClass, bool&gt; GetCheck()
  {
      return (x) =&gt; x.Value &gt; 10;
  }
  </code></pre>
  
  <p>Seems easy.  The problem that I'm having is when I apply it to a LINQ expression that's used in LINQ To Entities.  I get an error that says Invoke is not supported.  And I understand <em>why</em>.  What I don't know is if there's a way that I can get around this.  I would like to say...</p>
  
  <pre><code>var check = GetCheck();
  IQueryable&lt;MyClass&gt; results = MyClasses.Where(y =&gt; check(y));
  </code></pre>
  
  <p>... and have the expression tree inspector realize that everything that happens in the Func is perfectly legal both in LINQ To Entities and on the DB.  It seems like it should be inline'd.</p>
  
  <p>Is there anything I can do to make this happen?  Any form of declaration for the delegate that will allow this?</p>