我在创建排序表达式时遇到问题。
我有一个Expression<Func<Products, bool>>
已经包含查询表达式的类型表达式。我想做查询排序,但没有成功。
下面,在 CreateSortExpression 方法中有一个错误:
private Expression<Func<Products, bool>> CreateOrderQuery(Expression<Func<Products, bool>> condition, descriptorOrder item)
{
condition= condition.AndAlso(CreateSortExpression(item.PropertyName));
return condition;
}
private Expression<Func<Products, bool>> CreateSortExpression(string p)
{
Expression<Func<Products, bool>> condition = products =>
p.OrderBy(products.Options.price);
return condition;
}
无法从用法中推断出错误消息“System.Linq.Enumerable.OrderBy(System.Collections.Generic.IEnumerable, System.Func)”。尝试明确指定类型参数。
有没有人经历过这个可以帮助我?谢谢。