title: EF + LINQ: How do I define and utilize a variable (maybe a Func variable) to define part of a Select statement?
body: <p>Before try to use a variable (this has sql server do the calculation):</p>
  
  <pre><code>IQueryable&lt;MyEntity&gt; query = _dbSet; // IQueryable&lt;TEntity&gt;
  var results = query.Select(m =&gt; new MyViewModel
  {
      MyCalculation = m.Column1 * m.Column2
  }).ToList();
  </code></pre>
  
  <p>What I want to do (dynamically create part of my select statement from a Func variable or some other kind of variable to allow this):</p>
  
  <pre><code>IQueryable&lt;MyEntity&gt; query = _dbSet; // IQueryable&lt;TEntity&gt;
  Func&lt;MyEntity, decimal&gt; funcVariableAttempt = m =&gt; m.Column1 * m.Column2;
  var results = query.Select(m =&gt; new MyViewModel
  {
      MyCalculation = funcVariableAttempt.Invoke(m) // My foolish attempt does not work.
  }).ToList();
  </code></pre>
  
  <p>The error I get when I try what I want (aka my foolish attempt):</p>
  
  <blockquote>
    <p>LINQ to Entities does not recognize the method 'System.Decimal Invoke(MyProject.Repository.Models.MyEntity)' method, and this method cannot be translated into a store expression.</p>
  </blockquote>
  
  <p>How do I define and utilize a variable (maybe a Func variable) to define part of a Select statement?</p>