title: Creating expression trees from lambda
body: <p>I have a lambda expression:</p>
  
  <pre><code>(x) =&gt; x.Visits++
  </code></pre>
  
  <p>At runtime, I want to translate this into the string:</p>
  
  <pre><code>"set Visits = Visits + 1"
  </code></pre>
  
  <p>or, potentially, if the underlying data store is different (like MongoDB)</p>
  
  <pre><code>{$inc: {Visits : 1}}
  </code></pre>
  
  <p>I think the way to do this is to use expression trees, but when I assign the lambda expression to an expression tree, I get "An expression tree may not contain an assignment operator".</p>
  
  <p>Is there any way to accomplish this short of writing a full up linq implementation that supports Update?</p>