我有这个代码:
public static Expression<Func<T, bool>> CreatePredicate<T>(string typeSearch, string searchField, string stringToSearch)
{
var parameter = Expression.Parameter(typeof(T));
var predicate = Expression.Lambda<Func<T, bool>>(
Expression.Call(
Expression.PropertyOrField(parameter, searchField),
"Contains", null,
Expression.Constant(stringToSearch.ToUpper())), parameter);
return predicate;
}
结果是:{Param_0 => Param_0.Username.Contains("MX")}
但我想要这个:{Param_0 => Param_0.Username.ToUpper().Contains("MX")}
谢谢,