示例#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(QueryIsNullExpression expression)
        {
            // Cannot be a collection
            ExceptionUtilities.Assert(!(expression.Argument.ExpressionType is QueryCollectionType), "IsNull expression cannot be a collection");
            var argument = this.Evaluate(expression.Argument);

            return(argument.Type.EvaluationStrategy.BooleanType.CreateValue(argument.IsNull));
        }
        /// <summary>
        /// Replaces the given expression.
        /// </summary>
        /// <param name="expression">Expression to replace.</param>
        /// <returns>Replaced expression.</returns>
        public QueryExpression Visit(QueryIsNullExpression expression)
        {
            var argument = this.ReplaceExpression(expression.Argument);

            if (this.HasChanged(expression.Argument, argument))
            {
                return(new QueryIsNullExpression(argument, expression.ExpressionType));
            }
            else
            {
                return(expression);
            }
        }
            /// <summary>
            /// Visits a QueryExpression tree whose root node is the QueryIsNullExpression.
            /// </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(QueryIsNullExpression expression)
            {
                string argument = this.Convert(expression.Argument);

                return string.Format(CultureInfo.InvariantCulture, "{0} eq null", argument);
            }
示例#4
0
 /// <summary>
 /// Visits a QueryExpression tree whose root node is the QueryIsNullExpression.
 /// </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(QueryIsNullExpression 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(QueryIsNullExpression expression)
        {
            var argument = this.ResolveTypes(expression.Argument);

            return(new QueryIsNullExpression(argument, this.EvaluationStrategy.BooleanType));
        }
示例#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(QueryIsNullExpression expression)
        {
            var argument = this.GenerateCode(expression.Argument);

            return(Code.ValueEquals(argument, Code.Null()));
        }
            /// <summary>
            /// Visits a QueryExpression tree whose root node is the QueryIsNullExpression.
            /// </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(QueryIsNullExpression expression)
            {
                string argument = this.Convert(expression.Argument);

                return(string.Format(CultureInfo.InvariantCulture, "{0} eq null", argument));
            }