title: Implementing a custom LINQ-to-X provider
body: <p>I've got a search tool which takes a complex search string (actually, an n-level object graph in JSON) and returns some results. I want to expose the functionality to other (internal) developers through a LINQ-like mechanism.</p>
  
  <p>Assuming each result is defined by a class <code>Result</code></p>
  
  <p>I can create methods look something like:</p>
  
  <pre><code>Function Search(Expression As Linq.Expression(Of System.Func(Of Result, Boolean))) As IEnumerable(Of Result)
  </code></pre>
  
  <p>What I'm unclear of is how I can walk that <code>Expression</code> parameter and extract the actual criteria which I can then form into the object graph for running my query.</p>
  
  <p>Can someone point me at a tutorial/example of how this can be achieved?</p>
  
  <p>For a little background, I've managed to dig into the expression far enough to get the recursive structure and am able to examine the <code>.Body</code> of lambda expressions but when I get as far as wanting to handle the <code>Left</code> and <code>Right</code> properties of a Node with eg type <code>ExpressionType.Or</code>, I'm having issues. The debugger is using a Friend-scoped class (<code>BinaryExpressionProxy</code>) to examine the expression which isn't available to me so I'm clearly heading down the wrong route.</p>