Example #1
0
        /// <summary>
        /// Evaluates the specified expression.
        /// </summary>
        /// <param name="expression">The expression to evaluate.</param>
        /// <returns>Value of the expression.</returns>
        public QueryValue Visit(QueryAndExpression expression)
        {
            QueryScalarValue left, right;

            this.EvaluateBinaryArguments(expression, out left, out right);

            // short circuit "And" logic if left is false (and evaluation did not throw any exceptions)
            // TODO: this is sort of a hack, we should have more solid way of check whether given EvaluationError is actual exception or just list of ingnorable exceptions
            bool leftThrewEvaluationException = left.EvaluationError != null && !string.IsNullOrEmpty(left.EvaluationError.ToString());

            if (!left.IsNull && (bool)left.Value == false && !leftThrewEvaluationException)
            {
                return(left);
            }

            return(left.AndAlso(right));
        }
 /// <summary>
 /// Visits a QueryExpression tree whose root node is the QueryAndExpression.
 /// </summary>
 /// <param name="expression">The root node of the expression tree being visited.</param>
 /// <returns>Uri query string representing the expression.</returns>
 public override string Visit(QueryAndExpression expression)
 {
     return this.VisitBinaryExpession(expression, "{0} and {1}");
 }
 /// <summary>
 /// Replaces the given expression.
 /// </summary>
 /// <param name="expression">Expression to replace.</param>
 /// <returns>Replaced expression.</returns>
 public virtual QueryExpression Visit(QueryAndExpression expression)
 {
     return(this.VisitBinaryExpression(expression, CommonQueryBuilder.And));
 }
Example #4
0
 /// <summary>
 /// Visits a QueryExpression tree whose root node is the QueryAndExpression.
 /// </summary>
 /// <param name="expression">The root node of the expression tree being visited.</param>
 /// <returns>Uri query string representing the expression.</returns>
 public virtual string Visit(QueryAndExpression expression)
 {
     throw new TaupoNotSupportedException("Not supported");
 }
 /// <summary>
 /// Resolves types for the specified expression.
 /// </summary>
 /// <param name="expression">The expression to resolve types for.</param>
 /// <returns>Expression with resolved types.</returns>
 public QueryExpression Visit(QueryAndExpression expression)
 {
     return(this.VisitBinaryExpressionWithBooleanResult(expression, CommonQueryBuilder.And));
 }
Example #6
0
 /// <summary>
 /// Generates System.CodeDom.CodeExpression from the given expression.
 /// </summary>
 /// <param name="expression">Expression from which System.CodeDom.CodeExpression is generated.</param>
 /// <returns>Generated System.CodeDom.CodeExpression.</returns>
 public virtual CodeExpression Visit(QueryAndExpression expression)
 {
     return(this.VisitBinaryExpression(expression, CodeBinaryOperatorType.BooleanAnd));
 }
 /// <summary>
 /// Visits a QueryExpression tree whose root node is the QueryAndExpression.
 /// </summary>
 /// <param name="expression">The root node of the expression tree being visited.</param>
 /// <returns>Uri query string representing the expression.</returns>
 public override string Visit(QueryAndExpression expression)
 {
     return(this.VisitBinaryExpession(expression, "{0} and {1}"));
 }