用法

集合過濾器= new List(); QueryFilter filter = new QueryFilter(NameBurger,Operator.StartsWith); filters.Add(過濾器);

 Expression<Func<Food, bool>> query = ExpressionBuilder.GetExpression<Food>(filters);

在這種情況下,它是對 Food 實體的查詢,想要查詢名稱中以 Burger 開頭的所有食物。

輸出:

query = {parm => a.parm.StartsWith("Burger")}

Expression<Func<T, bool>> GetExpression<T>(IList<QueryFilter> filters)