📜  IQueryable 查询 camleCase 属性 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:15.204000             🧑  作者: Mango

代码示例1
private static Expression> CreateLike(PropertyInfo prop, string value)
    {
        var parameter = Expression.Parameter(typeof(T), "f");
        var propertyAccess = Expression.MakeMemberAccess(parameter, prop);

        var indexOf = Expression.Call(propertyAccess, "IndexOf", null, Expression.Constant(value, typeof(string)),Expression.Constant(StringComparison.InvariantCultureIgnoreCase));
        var like=Expression.GreaterThanOrEqual(indexOf, Expression.Constant(0));
        return Expression.Lambda>(like, parameter);
    }