title: Fluent validation error: Enumeration yielded no results
body: <p>I would like to ask for your help. I want to validate my delete request class. The rule is: </p>
  
  <blockquote>
    <p>"Deletion allowed only for one element with the biggest price in
    database for each type of product"</p>
  </blockquote>
  
  <p>. repositoryEntities is not null but the Result is: Enumeration yielded no results.</p>
  
  <p>Can you please check below code and let me know what is wrong?</p>
  
  <pre><code>private void CanIDelete(DeleteProductRequest entity, CustomContext context)
  {
     var repositoryEntities = _productRepository.Queryable.Where(s =&gt; s.TypeOfProductId.Equals(entity.TypeOfProductId) &amp;&amp; !s.IsDeleted);
  
     if (repositoryEntities != null)
     {
        var theBiggestPriceInDatabase = Decimal.MinValue;
        foreach (var repositoryEntity in repositoryEntities)
        {
          if (theBiggestPriceInDatabase &lt; repositoryEntity.Price)
          {
              theBiggestPriceInDatabase = repositoryEntity.Price;
              continue;
          }
          if (entity.Price != theBiggestPriceInDatabase)
          {
              context.AddFailure("Deletion allowed only for one product 'with the biggest price' in database for each type of product");
              return;
          }
      }
  }
  </code></pre>