コード例 #1
0
        public override DbExpression Visit(DbArithmeticExpression expression)
        {
            EntityUtil.CheckArgumentNull(expression, "expression");

            DbExpression         result       = expression;
            IList <DbExpression> newArguments = this.VisitExpressionList(expression.Arguments);

            if (!object.ReferenceEquals(expression.Arguments, newArguments))
            {
                switch (expression.ExpressionKind)
                {
                case DbExpressionKind.Divide:
                    result = CqtBuilder.Divide(newArguments[0], newArguments[1]);
                    break;

                case DbExpressionKind.Minus:
                    result = CqtBuilder.Minus(newArguments[0], newArguments[1]);
                    break;

                case DbExpressionKind.Modulo:
                    result = CqtBuilder.Modulo(newArguments[0], newArguments[1]);
                    break;

                case DbExpressionKind.Multiply:
                    result = CqtBuilder.Multiply(newArguments[0], newArguments[1]);
                    break;

                case DbExpressionKind.Plus:
                    result = CqtBuilder.Plus(newArguments[0], newArguments[1]);
                    break;

                case DbExpressionKind.UnaryMinus:
                    result = CqtBuilder.UnaryMinus(newArguments[0]);
                    break;

                default:
                    throw EntityUtil.NotSupported();
                }
            }
            NotifyIfChanged(expression, result);
            return(result);
        }