Example #1
0
        private static string Clean(Expression condition)
        {
            var binary = condition as BinaryExpression;

            string str = null;

            if (binary?.NodeType == ExpressionType.Equal)
            {
                var constant = binary.Right as ConstantExpression;

                if (constant != null && constant.Type == typeof(bool) && constant.Value.Equals(true))
                {
                    str = ExtensionReducer.Reduce(binary.Left).ToString();
                }
            }

            if (str == null)
            {
                str = ExtensionReducer.Reduce(condition).ToString();
            }

            if (str.StartsWith("(") && str.EndsWith(")"))
            {
                return(str.Substring(1, str.Length - 2));
            }

            return(str);
        }
Example #2
0
        protected Expression Reduce(Expression source, Expression arg1)
        {
            if (arg1 == null)
            {
                return(Call(null, Method.Method, source));
            }

            return(Call(null, Method.Method, source, ExtensionReducer.Reduce(arg1)));
        }
Example #3
0
 public static Exception MergeMultiParameterLambda(LinqExpression node, LinqExpression innerExpr)
 {
     return(new NotSupportedException($"Cannot merge method '{node.Method.Method.Name}' in expression '{ExtensionReducer.Reduce(node)}': one or more lambda expressions reference multiple lambda parameters. {localSplit}"));
 }