I try do implement a user dynamic filter, where used selects some properties, selects some operators and selects also the values.
As I didn\'t find yet an answer to
// ???????????????????????? DOES NOT WORK
var kitchens = houses.AsQueryable().Where(comparison);
The Where method takes a Func or a Expression as the parameter, but the variable comparison is of type LambdaExpression, which doesn't match. You need to use another overload of the method:
var comparison = Expression.Lambda>(
Expression.Equal(houseMainRoomTypeParam,
Expression.Constant("Kitchen", typeof(RoomType))));
//now the type of comparison is Expression>
//the overload in Expression.cs
public static Expression Lambda(Expression body, params ParameterExpression[] parameters);