title: EF Core - Using extension method inside Where
body: <p>I have the following extension method to calculate Product's average rating.</p>
  
  <pre><code>public static class Extensions
  {
      public static decimal CalculateAverageRating(this ICollection&lt;ProductReview&gt; productReviews)
      {
          // Calculate and return average rating
  
          return averageRatings;
      }
  }
  </code></pre>
  
  <p>I want to use this method in an EF queryable where like this: </p>
  
  <pre><code>var products = _context.Products
              .Include(pr =&gt; pr.ProductReviews)
              .AsQueryable();
  
          if(searchParams.Rating != 0)
              products = products.Where(p =&gt; p.ProductReviews.CalculateAverageRating() == searchParams.Rating);
  </code></pre>
  
  <p>However im keep hitting the error "ArgumentException: Expression of type 'System.Collections.Generic.IAsyncEnumerable<code>1[Products.Reviews.ProductReview]' cannot be used for parameter of type 'System.Collections.Generic.IEnumerable</code>1[System.Object]' of method ". </p>
  
  <p>Can we use extension method in a EF Where? Please advice me on this.</p>