I am trying to get all pens when are not blue by using below expression. there are two lists pens and bluepens...
var pensToDelete = _repository.GetPens().Where(x => bluePens.All(y => y.Id != x.Id));
when I am accessing pensToDelete as below
if (pensToDelete .Count() > 0)
{
}
I get the below error:
System.InvalidOperationException: 'The LINQ expression 'DbSet() .Where(a => __bluePens_0 .All(y => y.Id != a.Id))' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'.
Not sure how to fix this