Exemplo n.º 1
0
 public override void AddWhere(ConstantExpression exp, ExpressionInfo arg)
 {
     if (exp.Type.Name.Contains("DisplayClass"))
     {
         var type  = exp.Value.GetType();
         var value = type.InvokeMember(arg.ConstantName, BindingFlags.GetField, null, exp.Value, null);
         arg.SetObjectValue(value);
     }
     else
     {
         arg.SetMethodParameter(exp.Value);
     }
 }
Exemplo n.º 2
0
 public override void AddWhere(MemberExpression exp, ExpressionInfo arg)
 {
     if (exp.Expression != null)
     {
         // 存储变量名称,再需要解析变量值的时候获取此字段的值
         arg.ConstantName = exp.Member.Name;
         HelperTool.AddWhere(exp.Expression, arg);
         arg.SetObject(exp.Member.Name);
     }
     else
     {
         var fi  = (PropertyInfo)exp.Member;
         var val = fi.GetValue(((ConstantExpression)exp.Expression)?.Value, null);
         arg.SetObjectValue(val);
     }
 }