Пример #1
0
        protected override Expression VisitSetCommand(SqlSetCommandExpression expression)
        {
            SqlSetCommandExpression current;

            if (!TryGetCurrent(expression, out current))
            {
                return(expression);
            }

            if (expression.ConfigurationParameter != current.ConfigurationParameter)
            {
                result = false;

                return(expression);
            }

            currentObject = current.Target;
            this.Visit(expression.Target);
            currentObject = current;

            if (!result)
            {
                return(expression);
            }

            this.VisitExpressionList(expression.Arguments);

            if (!result)
            {
                return(expression);
            }

            return(expression);
        }
Пример #2
0
        protected virtual Expression VisitSetCommand(SqlSetCommandExpression expression)
        {
            var target    = this.Visit(expression.Target);
            var arguments = this.VisitExpressionList(expression.Arguments);

            if (target != expression.Target || arguments != expression.Arguments)
            {
                return(new SqlSetCommandExpression(expression.ConfigurationParameter, target, arguments));
            }

            return(expression);
        }
        protected override Expression VisitSetCommand(SqlSetCommandExpression expression)
        {
            SqlSetCommandExpression current;
            if (!TryGetCurrent(expression, out current))
            {
                return expression;
            }

            if (!(this.result &= object.Equals(current.ConfigurationParameter, expression.ConfigurationParameter)))
            {
                return expression;
            }

            if (!(this.result &= current.NodeType == expression.NodeType))
            {
                return expression;
            }

            if (!(this.result &= current.Type == expression.Type))
            {
                return expression;
            }

            this.currentObject = current.Target;
            this.Visit(expression.Target);
            if (!this.result)
            {
                return expression;
            }

            this.currentObject = current.Arguments;
            this.VisitExpressionList(expression.Arguments);
            if (!this.result)
            {
                return expression;
            }

            this.currentObject = current;
            return expression;
        }
Пример #4
0
 protected override Expression VisitSetCommand(SqlSetCommandExpression expression)
 {
     this.hashCode ^= expression.ConfigurationParameter?.GetHashCode() ?? 0;
     return(base.VisitSetCommand(expression));
 }
Пример #5
0
        protected override Expression VisitSetCommand(SqlSetCommandExpression expression)
        {
            this.Write("SET ");
            switch (expression.ConfigurationParameter)
            {
            case "IdentityInsert":
                this.Write("IDENTITY_INSERT");
                break;
            default:
                this.Write(expression.ConfigurationParameter);
                break;
            }

            if (expression.Target != null)
            {
                this.Write(" ");
                this.Write(((SqlTableExpression)expression.Target).Name);
                this.Write(" ");
            }

            if (expression.ConfigurationParameter == "IdentityInsert")
            {
                this.Write((bool)((ConstantExpression)expression.Arguments[0].Reduce()).Value ? "ON" : "OFF");
            }
            else
            {
                this.Write(" ");
                this.Write(expression.Arguments);
            }

            this.WriteLine();

            return expression;
        }
 protected override Expression VisitSetCommand(SqlSetCommandExpression expression)
 {
     this.hashCode ^= expression.ConfigurationParameter?.GetHashCode() ?? 0;
     return base.VisitSetCommand(expression);
 }
Пример #7
0
        protected override Expression VisitSetCommand(SqlSetCommandExpression expression)
        {
            this.Write("SET ");
            this.Write(expression.ConfigurationParameter);

            if (expression.Target != null)
            {
                this.Write(" ");
                this.Visit(expression.Target);
                this.Write(" ");
            }

            this.Write(" ");
            this.Write(expression.Arguments);

            return base.VisitSetCommand(expression);
        }
Пример #8
0
		protected virtual Expression VisitSetCommand(SqlSetCommandExpression expression)
		{
			var target = this.Visit(expression.Target);
			var arguments = this.VisitExpressionList(expression.Arguments);

			if (target != expression.Target || arguments != expression.Arguments)
			{
				return new SqlSetCommandExpression(expression.ConfigurationParameter, target, arguments);
			}

			return expression;
		}
Пример #9
0
		protected override Expression VisitSetCommand(SqlSetCommandExpression expression)
		{
			this.Write("SET ");

			if (expression.ConfigurationParameter != null)
			{
				this.Write(expression.ConfigurationParameter);
			}

			if (expression.Target != null)
			{
				this.Write(" ");
				this.Visit(expression.Target);
				this.Write(" ");
			}

			this.Write(" ");
			this.WriteDeliminatedListOfItems(expression.Arguments, c => this.Visit(c));
			this.WriteLine(";");
			
			return expression;
		}