Beispiel #1
0
 protected override Expression Visit(Expression exp)
 {
     if (exp != null && (exp == this.searchFor || exp.Equals(this.searchFor)))
     {
         return this.replaceWith;
     }
     return base.Visit(exp);
 }
        private Expression generateSelect(Expression query, Expression body, ParameterExpression lambdaParam)
        {
            if(body.Equals(lambdaParam))
            {
                return query;
            }
            MethodInfo selectSpecificMethod = getOperatorMethod(query.Type, LinqInfo.LINQOperator.LINQOperatorType.Select, 2, lambdaParam.Type, body.Type);

            LambdaExpression lambda = generateLambda(selectSpecificMethod.GetParameters()[1].ParameterType, body, lambdaParam);
            return Expression.Call(selectSpecificMethod, query, makeLambdaMethodArgument(selectSpecificMethod, lambda));
        }
 public override bool IsMatch(Expression node)
 {
     return node.Equals(this.source);
 }