protected override void AcceptInternal(IExpressionVisitor visitor)
 {
     if (_nodes == null)
         return;
     for (int index = 0; index < _nodes.Count; index++)
         _nodes[index] = AcceptWithCheck(visitor, _nodes[index], true);
 }
 /// <summary>
 /// Accept an expression visitor
 /// </summary>
 /// <param name="visitor">The expression visitor</param>
 public virtual void Accept(IExpressionVisitor visitor)
 {
     if (visitor == null)
     {
         throw new ArgumentNullException("visitor");
     }
     visitor.Visit(this);
 }
        public override void Accept(IExpressionVisitor visitor)
        {
            if (!visitor.BeforeVisit(this))
                return;

            Expression.Accept(visitor);

            visitor.AfterVisit(this);
        }
 protected override void AcceptInternal(IExpressionVisitor visitor)
 {
     if (Target != null)
         _target = AcceptWithCheck(visitor, Target, false);
     for (int index = 0; index < _arguments.Count; index++)
     {
         _arguments[index] = AcceptWithCheck(visitor, _arguments[index], true);
     }
 }
 protected override void AcceptInternal(IExpressionVisitor visitor)
 {
     _operand = AcceptWithCheck(visitor, Operand, true);
 }
Пример #6
0
		internal abstract void VisitorCall(IExpressionVisitor visitor);
Пример #7
0
 public static Expression Visit(Expression expression, IExpressionVisitor visitor)
 {
     return expression.Visit(visitor);
 }
Пример #8
0
        protected NodeVisitor(IExpressionVisitor expressionVisitor)
        {
            _expressionVisitor = expressionVisitor;
		}
Пример #9
0
 protected virtual void VisitJoin(IExpressionVisitor visitor, DeleteStatement statement, JoinClause joining)
 {
     visitor.VisitJoin(joining);
 }
Пример #10
0
 public override void Accept(IExpressionVisitor v)
 {
     v.VisitConditionOf(this);
 }
Пример #11
0
 public abstract TResult Accept <TContext, TResult>(IExpressionVisitor <TContext, TResult> visitor, TContext context);
Пример #12
0
		public virtual void Accept(IExpressionVisitor visitor)
		{
			visitor.Visit(this);
		}
Пример #13
0
 public override void Accept(IExpressionVisitor v)
 {
     v.VisitPhiFunction(this);
 }
Пример #14
0
 public override TResult Accept <TResult>(IExpressionVisitor <TResult> visitor)
 {
     return(visitor.Visit(this));
 }
Пример #15
0
 /// <summary>
 /// Visits the specified expression visitor.
 /// </summary>
 /// <typeparam name="TImmutableParameter">The type of the parameter1.</typeparam>
 /// <typeparam name="TMutableParameter">The type of the parameter2.</typeparam>
 /// <typeparam name="TResult">The type of the result.</typeparam>
 /// <param name="expressionVisitor">The expression visitor.</param>
 /// <param name="parameter1">The parameter1.</param>
 /// <param name="parameter2">The parameter2.</param>
 public abstract void Visit <TImmutableParameter, TMutableParameter, TResult>(
     IExpressionVisitor <TImmutableParameter, TMutableParameter, TResult> expressionVisitor,
     TImmutableParameter parameter1,
     TMutableParameter parameter2);
Пример #16
0
 public T Accept <T>(IExpressionVisitor <T> visitor)
 {
     return(visitor.FieldAccess(this));
 }
Пример #17
0
 public void Accept(IExpressionVisitor visitor)
 {
     visitor.FieldAccess(this);
 }
Пример #18
0
 public abstract void Accept(IExpressionVisitor visitor);
 protected override void AcceptInternal(IExpressionVisitor visitor)
 {
 }
 /// <summary>
 ///     Dispatches to the specific visit method for this node type.
 /// </summary>
 /// <param name="visitor">The visitor to visit this node with.</param>
 protected override void AcceptInternal(IExpressionVisitor visitor)
 {
 }
Пример #21
0
 internal override void VisitorCall(IExpressionVisitor visitor)
 {
     visitor.CallVisitor(this);
 }
		protected override void VisitReturning(IExpressionVisitor visitor, ReturningClause returning)
		{
			/*
			 * 由于 MySQL 的 DELETE 语句不支持 RETURN|RETURNING 子句,故不输出任何内容,且不调用基类同名方法以避免生成错误的语句。
			 */
		}
Пример #23
0
 public override TResult Accept <TResult, TContext>(
     IExpressionVisitor <TResult, TContext> visitor,
     TContext environment)
 {
     return(visitor.Visit(this, environment));
 }
Пример #24
0
 public void Accept(IExpressionVisitor visitor)
 {
 }
Пример #25
0
 public abstract T Accept <T>(IExpressionVisitor <T> visitor);
 protected override void AcceptInternal(IExpressionVisitor visitor)
 {
     if (RelativeSourceExpression != null)
         _relativeSourceExpression = AcceptWithCheck(visitor, RelativeSourceExpression, true);
 }
Пример #27
0
 /// <summary>
 /// Visits the <paramref name="visitor"/> based upon the type of the
 /// <see cref="IExpression"/>.
 /// </summary>
 /// <param name="visitor">The <see cref="IIntermediateTreeVisitor"/>
 /// to visit.</param>
 /// <remarks>In this instance visits the <paramref name="visitor"/>
 /// through <see cref="IExpressionVisitor.Visit(ITypeReferenceExpression)"/>.</remarks>
 /// <exception cref="System.ArgumentNullException">thrown when <paramref name="visitor"/>
 /// is null.</exception>
 public void Accept(IExpressionVisitor visitor)
 {
     //ToDo: Fix #2.
     visitor.Visit(this);
 }
Пример #28
0
 protected virtual void VisitFrom(IExpressionVisitor visitor, DeleteStatement statement, ICollection <ISource> sources)
 {
     visitor.VisitFrom(sources, (v, j) => this.VisitJoin(v, statement, j));
 }
Пример #29
0
 public override void Accept <T>(IExpressionVisitor <T> visitor)
 => visitor.VisitTypeReference(this);
 /// <summary>
 ///     Calls the visitor on the expression.
 /// </summary>
 protected override void AcceptInternal(IExpressionVisitor visitor)
 {
     _condition = AcceptWithCheck(visitor, Condition, true);
     _ifTrue = AcceptWithCheck(visitor, IfTrue, true);
     _ifFalse = AcceptWithCheck(visitor, IfFalse, true);
 }
Пример #31
0
 public override void Accept(IExpressionVisitor v)
 {
     v.VisitConstant(this);
 }
Пример #32
0
		public abstract void Accept(IExpressionVisitor arg1);
Пример #33
0
 public virtual void Visit(IExpressionVisitor visitor)
 {
     visitor.Visit(this);
 }
Пример #34
0
 protected virtual Expression Visit(IExpressionVisitor visitor)
 {
     return visitor.Visit(this);
 }
Пример #35
0
 public override void Accept(IExpressionVisitor v)
 {
     v.VisitUnaryExpression(this);
 }
Пример #36
0
 public override void Accept(IExpressionVisitor visitor)
 {
     Operand.Accept(visitor);
     visitor.Visit(this);
 }
Пример #37
0
 public override void Accept(IExpressionVisitor visitor)
 {
     visitor.VisitConditionalExpression(this);
 }
 protected override void AcceptInternal(IExpressionVisitor visitor)
 {
     if (Target != null)
         _target = AcceptWithCheck(visitor, Target, false);
 }
Пример #39
0
 public T Accept <T>(IExpressionVisitor <T> visitor) => visitor.VisitFunctionCall(this);
Пример #40
0
 public override void Accept(IExpressionVisitor visitor)
 {
     Require.NotNull(visitor, "visitor");
     visitor.Visit(this);
 }
Пример #41
0
 public override TOutput AcceptVisitor <TContext, TOutput>(IExpressionVisitor <TContext, TOutput> visitor, TContext context)
 {
     EnsureArg.IsNotNull(visitor, nameof(visitor));
     return(visitor.VisitSortParameter(this, context));
 }
Пример #42
0
 public override void Accept(IExpressionVisitor visitor)
 {
     visitor.Visit(this);
 }
Пример #43
0
        protected override void OnVisit(IExpressionVisitor visitor, UpsertStatement statement)
        {
            if (statement.Returning != null && statement.Returning.Table != null)
            {
                visitor.Visit(statement.Returning.Table);
            }

            const string SOURCE_ALIAS = "SRC";

            if (statement.Fields == null || statement.Fields.Count == 0)
            {
                throw new DataException("Missing required fields in the upsert statment.");
            }

            visitor.Output.Append("MERGE INTO ");
            visitor.Visit(statement.Table);
            visitor.Output.AppendLine(" USING (SELECT ");

            for (int i = 0; i < statement.Values.Count; i++)
            {
                if (i > 0)
                {
                    visitor.Output.Append(",");
                }

                visitor.Visit(statement.Values[i]);
            }

            visitor.Output.AppendLine(") AS " + SOURCE_ALIAS + " (");

            for (int i = 0; i < statement.Fields.Count; i++)
            {
                if (i > 0)
                {
                    visitor.Output.Append(",");
                }

                visitor.Output.Append(statement.Fields[i].Name);
            }

            visitor.Output.AppendLine(") ON");

            for (int i = 0; i < statement.Entity.Key.Length; i++)
            {
                var field = Metadata.DataEntityPropertyExtension.GetFieldName(statement.Entity.Key[i], out _);

                if (i > 0)
                {
                    visitor.Output.Append(" AND ");
                }

                if (string.IsNullOrEmpty(statement.Table.Alias))
                {
                    visitor.Output.Append($"{field}={SOURCE_ALIAS}.{field}");
                }
                else
                {
                    visitor.Output.Append($"{statement.Table.Alias}.{field}={SOURCE_ALIAS}.{field}");
                }
            }

            if (statement.Updation.Count > 0)
            {
                visitor.Output.AppendLine();
                visitor.Output.Append("WHEN MATCHED");

                if (statement.Where != null)
                {
                    visitor.Output.Append(" AND ");
                    visitor.Visit(statement.Where);
                }

                visitor.Output.AppendLine(" THEN");
                visitor.Output.Append("\tUPDATE SET ");

                int index = 0;

                foreach (var item in statement.Updation)
                {
                    if (index++ > 0)
                    {
                        visitor.Output.Append(",");
                    }

                    visitor.Visit(item.Field);
                    visitor.Output.Append("=");
                    visitor.Visit(item.Value);
                }
            }

            visitor.Output.AppendLine();
            visitor.Output.AppendLine("WHEN NOT MATCHED THEN");
            visitor.Output.Append("\tINSERT (");

            for (int i = 0; i < statement.Fields.Count; i++)
            {
                if (i > 0)
                {
                    visitor.Output.Append(",");
                }

                visitor.Output.Append(visitor.Dialect.GetIdentifier(statement.Fields[i]));
            }

            visitor.Output.Append(") VALUES (");

            for (int i = 0; i < statement.Fields.Count; i++)
            {
                if (i > 0)
                {
                    visitor.Output.Append(",");
                }

                visitor.Output.Append(SOURCE_ALIAS + "." + statement.Fields[i].Name);
            }

            visitor.Output.Append(")");

            //输出返回子句
            this.VisitReturning(visitor, statement.Returning);

            visitor.Output.AppendLine(";");
        }
 protected override void AcceptInternal(IExpressionVisitor visitor)
 {
     Name = AcceptWithCheck(visitor, Name, true);
     Equal = AcceptWithCheck(visitor, Equal, true);
     Value = AcceptWithCheck(visitor, Value, true);
 }
Пример #45
0
 public override void Accept(IExpressionVisitor v)
 {
     v.VisitSlice(this);
 }
        protected override void AcceptInternal(IExpressionVisitor visitor)
        {
            StartTag = AcceptWithCheck(visitor, StartTag, true);
            if (StartTagEnd != null)
                StartTagEnd = AcceptWithCheck(visitor, StartTagEnd, true);
            if (EndTag != null)
                EndTag = AcceptWithCheck(visitor, EndTag, true);
            for (int i = 0; i < _elements.Count; i++)
            {
                XmlExpressionNode node = AcceptWithCheck(visitor, _elements[i], false);
                if (node == null)
                {
                    _elements.RemoveAt(i);
                    i--;
                }
                else
                    _elements[i] = node;
            }

            for (int i = 0; i < _attributes.Count; i++)
            {
                XmlExpressionNode node = AcceptWithCheck(visitor, _attributes[i], false);
                if (node == null)
                {
                    _attributes.RemoveAt(i);
                    i--;
                }
                else
                    _attributes[i] = node;
            }
        }
Пример #47
0
 public void AcceptExpressionVisitor(IExpressionVisitor visitor)
 {
     visitor.VisitUnknown(this);
 }
 protected override void AcceptInternal(IExpressionVisitor visitor)
 {
     _expression = AcceptWithCheck(visitor, Expression, true);
 }
Пример #49
0
 public void Accept(IExpressionVisitor visitor) => visitor.Visit(this);
 /// <summary>
 ///     Calls the visitor on the expression.
 /// </summary>
 protected override void AcceptInternal(IExpressionVisitor visitor)
 {
     _left = AcceptWithCheck(visitor, Left, true);
     _right = AcceptWithCheck(visitor, Right, true);
 }
Пример #51
0
 public abstract void Accept(IExpressionVisitor visitor);
Пример #52
0
 public override T Accept <T>(IExpressionVisitor <T> visitor)
 {
     return(visitor.VisitVariableExpr(this));
 }
Пример #53
0
 public override void Accept(IExpressionVisitor visitor)
 {
     visitor.VisitAssignment(this);
 }
Пример #54
0
		internal override void VisitorCall(IExpressionVisitor visitor) { visitor.CallVisitor(this); }
Пример #55
0
 public abstract TOutput AcceptVisitor <TContext, TOutput>(IExpressionVisitor <TContext, TOutput> visitor, TContext context);