public Expression Expand(Expression selfRef, IEnumerable <Expression> parameters) { this.selfRef = selfRef; string[] vals; try { vals = (string[])ExpressionExpander.Evaluate(parameters.First()); if (vals.Length == 0) { throw new Exception(); } } catch { throw new ArgumentException(string.Format("First argument for the '{0}' method must be non empty string array!", MethodName)); } // Init parameters contMeth = typeof(string).GetMethod("Contains"); // Combine using And when method is ContainsAll or using Or when method is ConainsAny var init = Expression.Call(selfRef, contMeth, Expression.Constant(vals[0])); return(vals.Skip(1).Fold <string, Expression>(Agg, init)); }
protected ExpressionExpandableMethodAttribute(ExpressionExpander <MethodCallExpression> customExpander) { CustomExpander = customExpander; }
protected ExpressionExpandablePropertyAttribute(ExpressionExpander <MemberExpression> customExpander) { CustomExpander = customExpander; }