Пример #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(QueryOrExpression expression)
        {
            QueryScalarValue left, right;

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

            // short circuit "Or" logic if left is true (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.EvaluationError == null && !left.IsNull && (bool)left.Value && !leftThrewEvaluationException)
            {
                return(left);
            }

            return(left.OrElse(right));
        }
 /// <summary>
 /// Visits a QueryExpression tree whose root node is the QueryOrExpression.
 /// </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(QueryOrExpression expression)
 {
     return this.VisitBinaryExpession(expression, "{0} or {1}");
 }
 /// <summary>
 /// Replaces the given expression.
 /// </summary>
 /// <param name="expression">Expression to replace.</param>
 /// <returns>Replaced expression.</returns>
 public virtual QueryExpression Visit(QueryOrExpression expression)
 {
     return(this.VisitBinaryExpression(expression, CommonQueryBuilder.Or));
 }
Пример #4
0
 /// <summary>
 /// Visits a QueryExpression tree whose root node is the QueryOrExpression.
 /// </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(QueryOrExpression 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(QueryOrExpression expression)
 {
     return(this.VisitBinaryExpressionWithBooleanResult(expression, CommonQueryBuilder.Or));
 }
Пример #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(QueryOrExpression expression)
 {
     return(this.VisitBinaryExpression(expression, CodeBinaryOperatorType.BooleanOr));
 }
 /// <summary>
 /// Visits a QueryExpression tree whose root node is the QueryOrExpression.
 /// </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(QueryOrExpression expression)
 {
     return(this.VisitBinaryExpession(expression, "{0} or {1}"));
 }