コード例 #1
0
        /// <summary>
        /// Main visit method for ALinqExpressionVisitor
        /// </summary>
        /// <param name="exp">The expression to visit</param>
        /// <returns>The visited expression </returns>
        internal override Expression Visit(Expression exp)
        {
            if (exp == null)
            {
                return(exp);
            }

            switch (exp.NodeType)
            {
            case ExpressionType.NewArrayInit:
                return(this.VisitNewArray((NewArrayExpression)exp));

            case ExpressionType.Quote:
                return(this.VisitUnary((UnaryExpression)exp));

            case ExpressionType.Constant:
                return(this.VisitConstant((ConstantExpression)exp));

            case ExpressionType.Call:
                return(this.VisitMethodCall((MethodCallExpression)exp));

            case ExpressionType.Lambda:
                return(this.VisitLambda((LambdaExpression)exp));

            default:
                throw new NotSupportedException(Strings.ALinq_UnsupportedExpression(exp.NodeType.ToString()));
            }
        }
コード例 #2
0
        /// <summary>
        /// MemberBinding visit method
        /// </summary>
        /// <param name="binding">The MemberBinding expression to visit</param>
        /// <returns>The visited MemberBinding expression </returns>
        internal virtual MemberBinding VisitBinding(MemberBinding binding)
        {
            switch (binding.BindingType)
            {
            case MemberBindingType.Assignment:
                return(this.VisitMemberAssignment((MemberAssignment)binding));

            case MemberBindingType.MemberBinding:
                return(this.VisitMemberMemberBinding((MemberMemberBinding)binding));

            case MemberBindingType.ListBinding:
                return(this.VisitMemberListBinding((MemberListBinding)binding));

            default:
                throw new NotSupportedException(Strings.ALinq_UnsupportedExpression(binding.BindingType.ToString()));
            }
        }
コード例 #3
0
        /// <summary>
        /// Main visit method for ALinqExpressionVisitor
        /// </summary>
        /// <param name="exp">The expression to visit</param>
        /// <returns>The visited expression </returns>
        internal virtual Expression Visit(Expression exp)
        {
            if (exp == null)
            {
                return(exp);
            }

            switch (exp.NodeType)
            {
            case ExpressionType.UnaryPlus:
            case ExpressionType.Negate:
            case ExpressionType.NegateChecked:
            case ExpressionType.Not:
            case ExpressionType.Convert:
            case ExpressionType.ConvertChecked:
            case ExpressionType.ArrayLength:
            case ExpressionType.Quote:
            case ExpressionType.TypeAs:
                return(this.VisitUnary((UnaryExpression)exp));

            case ExpressionType.Add:
            case ExpressionType.AddChecked:
            case ExpressionType.Subtract:
            case ExpressionType.SubtractChecked:
            case ExpressionType.Multiply:
            case ExpressionType.MultiplyChecked:
            case ExpressionType.Divide:
            case ExpressionType.Modulo:
#if !ODATA_CLIENT
            case ExpressionType.Power:
#endif
            case ExpressionType.And:
            case ExpressionType.AndAlso:
            case ExpressionType.Or:
            case ExpressionType.OrElse:
            case ExpressionType.LessThan:
            case ExpressionType.LessThanOrEqual:
            case ExpressionType.GreaterThan:
            case ExpressionType.GreaterThanOrEqual:
            case ExpressionType.Equal:
            case ExpressionType.NotEqual:
            case ExpressionType.Coalesce:
            case ExpressionType.ArrayIndex:
            case ExpressionType.RightShift:
            case ExpressionType.LeftShift:
            case ExpressionType.ExclusiveOr:
                return(this.VisitBinary((BinaryExpression)exp));

            case ExpressionType.TypeIs:
                return(this.VisitTypeIs((TypeBinaryExpression)exp));

            case ExpressionType.Conditional:
                return(this.VisitConditional((ConditionalExpression)exp));

            case ExpressionType.Constant:
                return(this.VisitConstant((ConstantExpression)exp));

            case ExpressionType.Parameter:
                return(this.VisitParameter((ParameterExpression)exp));

            case ExpressionType.MemberAccess:
                return(this.VisitMemberAccess((MemberExpression)exp));

            case ExpressionType.Call:
                return(this.VisitMethodCall((MethodCallExpression)exp));

            case ExpressionType.Lambda:
                return(this.VisitLambda((LambdaExpression)exp));

            case ExpressionType.New:
                return(this.VisitNew((NewExpression)exp));

            case ExpressionType.NewArrayInit:
            case ExpressionType.NewArrayBounds:
                return(this.VisitNewArray((NewArrayExpression)exp));

            case ExpressionType.Invoke:
                return(this.VisitInvocation((InvocationExpression)exp));

            case ExpressionType.MemberInit:
                return(this.VisitMemberInit((MemberInitExpression)exp));

            case ExpressionType.ListInit:
                return(this.VisitListInit((ListInitExpression)exp));

            default:
                throw new NotSupportedException(Strings.ALinq_UnsupportedExpression(exp.NodeType.ToString()));
            }
        }