Beispiel #1
0
        public override SqlFragment Visit(DbIsNullExpression expression)
        {
            IsNullFragment f = new IsNullFragment();

            f.Argument = expression.Argument.Accept(this);
            return(f);
        }
Beispiel #2
0
            public override void Visit(DbIsNullExpression expression)
            {
                Check.NotNull(expression, "expression");

                expression.Argument.Accept(this);
                _commandText.AppendKeyword(" is null");
            }
Beispiel #3
0
 public override void Visit(DbIsNullExpression expression)
 {
     Write(expression);
     _depth++;
     Write("Argument", expression.Argument);
     _depth--;
 }
Beispiel #4
0
        public override void Visit(DbIsNullExpression e)
        {
            Check.NotNull(e, "e");

            BeginUnary(e);
            End(e);
        }
        public override DbExpression Visit(DbIsNullExpression expression)
        {
            DebugCheck.NotNull(expression);

            var propertyExpression
                = expression.Argument as DbPropertyExpression;

            if (propertyExpression != null)
            {
                var parameter
                    = GetParameter((EdmProperty)propertyExpression.Property, originalValue: true);

                if (parameter != null)
                {
                    if (parameter.Item2)
                    {
                        // Current value, remove condition
                        return(null);
                    }

                    var parameterReferenceExpression
                        = new DbParameterReferenceExpression(parameter.Item1.TypeUsage, parameter.Item1.Name);

                    var equalityPredicate
                        = propertyExpression.Equal(parameterReferenceExpression);

                    var nullPredicate
                        = propertyExpression.IsNull().And(parameterReferenceExpression.IsNull());

                    return(equalityPredicate.Or(nullPredicate));
                }
            }

            return(base.Visit(expression));
        }
            /// <summary>
            /// Evaluate a null expression.
            /// </summary>
            /// <param name="node">Is null expression</param>
            /// <returns>A boolean expression describing the result of evaluating the Is Null predicate</returns>
            public override PropagatorResult Visit(DbIsNullExpression node)
            {
                Debug.Assert(null != node, "node is not visited when null");

                PropagatorResult argumentResult = Visit(node.Argument);
                bool             result         = argumentResult.IsNull;

                return(ConvertBoolToResult(result, argumentResult));
            }
Beispiel #7
0
        /// <summary>
        /// Implements the visitor pattern for <see cref="T:System.Data.Common.CommandTrees.DbIsNullExpression"/>.
        /// </summary>
        /// <param name="expression">The <see cref="T:System.Data.Common.CommandTrees.DbIsNullExpression"/> that is visited.</param>
        public override void Visit(DbIsNullExpression expression)
        {
            if (expression == null)
            {
                throw new ArgumentNullException("expression");
            }

            expression.Argument.Accept(this);
        }
            /// <summary>
            ///     Evaluate a null expression.
            /// </summary>
            /// <param name="node"> Is null expression </param>
            /// <returns> A boolean expression describing the result of evaluating the Is Null predicate </returns>
            public override PropagatorResult Visit(DbIsNullExpression node)
            {
                Check.NotNull(node, "node");

                var argumentResult = Visit(node.Argument);
                var result         = argumentResult.IsNull;

                return(ConvertBoolToResult(result, argumentResult));
            }
Beispiel #9
0
 /// <summary>
 /// <see cref="Visit(DbIsNullExpression)"/>
 /// </summary>
 /// <param name="e"></param>
 /// <param name="negate">Was the parent a DbNotExpression?</param>
 /// <returns></returns>
 private SqlBuilder VisitIsNullExpression(DbIsNullExpression e, bool negate)
 {
     if (!negate)
     {
         return(new SqlBuilder(e.Argument.Accept(this), " is null"));
     }
     else
     {
         return(new SqlBuilder(e.Argument.Accept(this), " is not null"));
     }
 }
Beispiel #10
0
        public override Expression Visit(DbIsNullExpression expression)
        {
            Expression source = this.Visit(expression.Argument);

            if (source.Type.IsValueType && !TypeHelper.IsNullable(source.Type))
            {
                return(Expression.Constant(false));
            }
            else
            {
                return(Expression.Equal(source, Expression.Constant(null)));
            }
        }
        public override Expression Visit(DbIsNullExpression expression)
        {
            Expression source = this.Visit(expression.Argument);

            if (source.Type.IsValueType && !TypeHelper.IsNullable(source.Type))
            {
                return Expression.Constant(false);
            }
            else
            {
                return Expression.Equal(source, Expression.Constant(null));
            }
        }
Beispiel #12
0
        public override DbExpression Visit(DbIsNullExpression expression)
        {
            DbPropertyExpression left = expression.Argument as DbPropertyExpression;

            if (left != null)
            {
                Tuple <FunctionParameter, bool> parameter = this.GetParameter((EdmProperty)left.Property, true);
                if (parameter != null)
                {
                    if (parameter.Item2)
                    {
                        return((DbExpression)null);
                    }
                    DbParameterReferenceExpression referenceExpression = new DbParameterReferenceExpression(parameter.Item1.TypeUsage, parameter.Item1.Name);
                    return((DbExpression)left.Equal((DbExpression)referenceExpression).Or((DbExpression)left.IsNull().And((DbExpression)referenceExpression.IsNull())));
                }
            }
            return(base.Visit(expression));
        }
 /// <summary>
 ///     Visitor pattern method for <see cref="DbIsNullExpression" />.
 /// </summary>
 /// <param name="expression"> The DbIsNullExpression that is being visited. </param>
 /// <exception cref="ArgumentNullException">
 ///     <paramref name="expression" />
 ///     is null
 /// </exception>
 public override void Visit(DbIsNullExpression expression)
 {
     VisitUnaryExpression(expression);
 }
Beispiel #14
0
        public override LegacyCommandTrees.DbExpression Visit(DbIsNullExpression expression)
        {
            Debug.Assert(expression != null, "expression != null");

            return(expression.Argument.Accept(this).IsNull());
        }
 public override void Visit(DbIsNullExpression expression)
 {
     expression.Argument.Accept((DbExpressionVisitor)this);
     this._commandText.Append(" is null");
 }
Beispiel #16
0
 public override ISqlFragment Visit(DbIsNullExpression e)
 {
     return(VisitIsNullExpression(e, false));
 }
Beispiel #17
0
 /// <summary>
 ///     Visitor pattern method for DbIsNullExpression.
 /// </summary>
 /// <param name="expression"> The DbIsNullExpression that is being visited. </param>
 public abstract void Visit(DbIsNullExpression expression);
        public override void Visit(DbIsNullExpression e)
        {
            Check.NotNull(e, "e");

            VisitUnary(e);
        }
Beispiel #19
0
 public override void Visit(DbIsNullExpression e)
 {
     VisitUnary(e);
 }
Beispiel #20
0
 /// <summary>
 ///     Typed visitor pattern method for DbIsNullExpression.
 /// </summary>
 /// <param name="expression"> The DbIsNullExpression that is being visited. </param>
 /// <returns> An instance of TResultType. </returns>
 public abstract TResultType Visit(DbIsNullExpression expression);
Beispiel #21
0
 public override TReturn Visit(DbIsNullExpression expression)
 {
     Check.NotNull <DbIsNullExpression>(expression, nameof(expression));
     throw this.ConstructNotSupportedException((DbExpression)expression);
 }
 public override void Visit(DbIsNullExpression expression)
 {
     // no-op
 }
 /// <summary>
 ///     Visitor pattern method for DbIsNullExpression.
 /// </summary>
 /// <param name="expression"> The DbIsNullExpression that is being visited. </param>
 public abstract void Visit(DbIsNullExpression expression);
Beispiel #24
0
            public override TreeNode Visit(DbIsNullExpression e)
            {
                Check.NotNull(e, "e");

                return(VisitUnary(e));
            }
 public override TReturn Visit(DbIsNullExpression expression)
 {
     throw ConstructNotSupportedException(expression);
 }
Beispiel #26
0
 public override VfpExpression Visit(DbIsNullExpression expression)
 {
     return(new VfpIsNullExpression(expression.ResultType, expression.Argument.Accept(this)));
 }
 public override void Visit(DbIsNullExpression expression)
 {
     // no-op
 }
 public override void Visit(DbIsNullExpression expression)
 {
     expression.Argument.Accept(this);
     _commandText.Append(" IS NULL");
 }
Beispiel #29
0
 public override DbExpressionEntitySetInfo Visit(DbIsNullExpression expression)
 {
     return(null);
 }
 public override void Visit(DbIsNullExpression e)
 {
     BeginUnary(e);
     End(e);
 }
Beispiel #31
0
 public override TreeNode Visit(DbIsNullExpression e)
 {
     Check.NotNull <DbIsNullExpression>(e, nameof(e));
     return(this.VisitUnary((DbUnaryExpression)e));
 }
Beispiel #32
0
        /// <summary>
        /// Implements the visitor pattern for <see cref="T:System.Data.Common.CommandTrees.DbIsNullExpression"/>.
        /// </summary>
        /// <param name="expression">The <see cref="T:System.Data.Common.CommandTrees.DbIsNullExpression"/> that is visited.</param>
        public override void Visit(DbIsNullExpression expression)
        {
            if (expression == null)
            {
                throw new ArgumentNullException("expression");
            }

            expression.Argument.Accept(this);
        }
 public override void Visit(DbIsNullExpression e)
 {
     VisitUnary(e);
 }
Beispiel #34
0
 public override void Visit(DbIsNullExpression e)
 {
     Check.NotNull <DbIsNullExpression>(e, nameof(e));
     this.VisitUnary((DbUnaryExpression)e);
 }
        /// <summary>
        ///     Visitor pattern method for <see cref="DbIsNullExpression" />.
        /// </summary>
        /// <param name="expression"> The DbIsNullExpression that is being visited. </param>
        /// <exception cref="ArgumentNullException">
        ///     <paramref name="expression" />
        ///     is null
        /// </exception>
        public override void Visit(DbIsNullExpression expression)
        {
            Check.NotNull(expression, "expression");

            VisitUnaryExpression(expression);
        }
Beispiel #36
0
 public override object Visit(DbIsNullExpression expression)
 {
     this.Visit(expression.Argument);
     return(null);
 }
 public override void Visit(DbIsNullExpression expression)
 {
     Contract.Requires(expression != null);
 }
Beispiel #38
0
            public override DbExpressionEntitySetInfo Visit(DbIsNullExpression expression)
            {
                Check.NotNull(expression, "expression");

                return(null);
            }
Beispiel #39
0
 public override bool Visit(DbIsNullExpression expression)
 {
     return(VisitUnaryExpression(expression));
 }
            public override void Visit(DbIsNullExpression expression)
            {
                Check.NotNull(expression, "expression");

                expression.Argument.Accept(this);
                _commandText.AppendKeyword(" is null");
            }
 public override void Visit(DbIsNullExpression expression)
 {
     expression.Argument.Accept(this);
     _commandText.Append(" is null");
 }
Beispiel #42
0
 public override bool Visit(DbIsNullExpression expression)
 {
     Check.NotNull <DbIsNullExpression>(expression, nameof(expression));
     return(this.VisitUnaryExpression((DbUnaryExpression)expression));
 }