I have this code:
public static bool ContainEx<T>(this IQueryable<T> query, System.Linq.Expressions.Expression<System.Func<T, bool>> expression)
{
return query.Any(expression);
}
If I use that:
return bonusesWhereSearch.WhereEx(x => userBonusesWhereSearch.ContainEx(y => y.Bonus_Id == x.Id));
I get this error message:
System.NotSupportedException: LINQ to Entities does not recognize the method 'Boolean ContainEx[Bonus](System.Linq.IQueryable`1[SDataEntities.Bonus], System.Linq.Expressions.Expression`1[System.Func`2[SDataEntities.Bonus,System.Boolean]])' method, and this method cannot be translated into a store expression.
and if I use Any
:
return bonusesWhereSearch.WhereEx(x => userBonusesWhereSearch.Any(y => y.Bonus_Id == x.Id));
that does work.