title: Method GetPrice() cannot be translated into a store expression
body: <p>I have a class method:</p>
  
  <pre><code>public static class ProductExtensions {
  
      public static decimal GetPrice(this Product product, Guid rateId) {
  
          return product.Prices
              .Where(p =&gt; p.Rate.RateId == rateId)
              .Select(b =&gt; b.UnitPrice)
              .DefaultIfEmpty(product.UnitPrice)
              .First();
      }
   }
  </code></pre>
  
  <p>and evaluating of an expression</p>
  
  <pre><code>        decimal? total = 
              (from cartItems in storeDB.Carts
              where cartItems.CartId == shoppingCartId
              select (int?)cartItems.Count * cartItems.Product.GetPrice(store.RateId))
              .Sum();
  </code></pre>
  
  <p>throw an exception:</p>
  
  <blockquote>
    <p>LINQ to Entities does not recognize the method 'System.Decimal GetPrice(System.Guid)' method, and this method cannot be translated into a store expression.</p>
  </blockquote>
  
  <p>I am using this very same code in other places and works just fine :</p>
  
  <pre><code>        // Get the price for given rate
          decimal price = product.GetPrice(rate.RateId);
  </code></pre>
  
  <p>Any idea how to solve it?</p>