title: Linq to EF - Unsupported Functions
body: <p>I'm making a query with Linq, backed by an Entity Framework datasource.</p>
  
  <p>I'm getting the following error:</p>
  
  <blockquote>
    <p>LINQ to Entities does not recognize the method 'Double Sqrt(Double)'
    method, and this method cannot be translated into a store expression.</p>
  </blockquote>
  
  <p>Here's a simplified version of my function (my version is more complex and uses ACos, sin, cos and other C# Math class functions).</p>
  
  <pre><code>  var objects =
              from n in context.Products.Where(p =&gt; p.r == r)
              let a = Math.Sqrt((double)n.Latitude)
              where a &lt; 5
              orderby a
              select n;
  
          return objects.Take(100).ToList();
  </code></pre>
  
  <p>I think the problem may be related to the situation that Linq to EF (and a SQL datasource) has a limited set of supported function compared to Linq to SQL. I'm relatively new to this so I'm not 100% sure.</p>
  
  <p>Can anyone give me a pointer in the right direction?</p>
  
  <p>Cheers,</p>