protected override Expression VisitIf(IFCommand ifx) { var test = Expression.Condition( ifx.Check, ifx.IfTrue, ifx.IfFalse != null ? ifx.IfFalse : ifx.IfTrue.Type == typeof(int) ? (Expression)Expression.Property(this.executor, "RowsAffected") : (Expression)Expression.Constant(TypeHelper.GetDefault(ifx.IfTrue.Type), ifx.IfTrue.Type)); return(this.Visit(test)); }
protected override Expression VisitIf(IFCommand ifx) { if (!this.Language.AllowsMultipleCommands) { return(base.VisitIf(ifx)); } this.Write("IF "); this.Visit(ifx.Check); this.WriteLine(Indentation.Same); this.Write("BEGIN"); this.WriteLine(Indentation.Inner); this.VisitStatement(ifx.IfTrue); this.WriteLine(Indentation.Outer); if (ifx.IfFalse != null) { this.Write("END ELSE BEGIN"); this.WriteLine(Indentation.Inner); this.VisitStatement(ifx.IfFalse); this.WriteLine(Indentation.Outer); } this.Write("END"); return(ifx); }
protected override Expression VisitIf(IFCommand ifx) { if (!this.Dialect.SupportMultipleCommands) { return(base.VisitIf(ifx)); } this.Append("IF "); this.Visit(ifx.Check); this.AppendLine(Indentation.Same); this.Append("BEGIN"); this.AppendLine(Indentation.Inner); this.VisitStatement(ifx.IfTrue); this.AppendLine(Indentation.Outer); if (ifx.IfFalse != null) { this.Append("END ELSE BEGIN"); this.AppendLine(Indentation.Inner); this.VisitStatement(ifx.IfFalse); this.AppendLine(Indentation.Outer); } this.Append("END"); return(ifx); }
protected override Expression VisitIf(IFCommand ifx) { throw new NotSupportedException(); }
protected override Expression VisitIf(IFCommand ifx) { if (!this.Language.AllowsMultipleCommands) { return base.VisitIf(ifx); } this.Write("IF "); this.Visit(ifx.Check); this.WriteLine(Indentation.Same); this.Write("THEN BEGIN"); this.WriteLine(Indentation.Inner); this.VisitStatement(ifx.IfTrue); this.WriteLine(Indentation.Outer); if (ifx.IfFalse != null) { this.Write("ELSE BEGIN"); this.WriteLine(Indentation.Inner); this.VisitStatement(ifx.IfFalse); this.WriteLine(Indentation.Outer); } this.Write("END IF;"); return ifx; }
protected override Expression VisitIf(IFCommand ifx) { if (!this.Dialect.SupportMultipleCommands) { return base.VisitIf(ifx); } this.Append("IF "); this.Visit(ifx.Check); this.AppendLine(Indentation.Same); this.Append("BEGIN"); this.AppendLine(Indentation.Inner); this.VisitStatement(ifx.IfTrue); this.AppendLine(Indentation.Outer); if (ifx.IfFalse != null) { this.Append("END ELSE BEGIN"); this.AppendLine(Indentation.Inner); this.VisitStatement(ifx.IfFalse); this.AppendLine(Indentation.Outer); } this.Append("END"); return ifx; }
protected virtual bool CompareIf(IFCommand x, IFCommand y) { return this.Compare(x.Check, y.Check) && this.Compare(x.IfTrue, y.IfTrue) && this.Compare(x.IfFalse, y.IfFalse); }
protected virtual Expression VisitIf(IFCommand ifx) { var check = this.Visit(ifx.Check); var ifTrue = this.Visit(ifx.IfTrue); var ifFalse = this.Visit(ifx.IfFalse); return this.UpdateIf(ifx, check, ifTrue, ifFalse); }
protected IFCommand UpdateIf(IFCommand ifx, Expression check, Expression ifTrue, Expression ifFalse) { if (check != ifx.Check || ifTrue != ifx.IfTrue || ifFalse != ifx.IfFalse) { return new IFCommand(check, ifTrue, ifFalse); } return ifx; }
private bool CompareIf(IFCommand x, IFCommand y) { return this.Compare(x.Check, y.Check) && this.Compare(x.IfTrue, y.IfTrue) && this.Compare(x.IfFalse, y.IfFalse); }
/// <summary> /// Visits if. /// </summary> /// <param name="ifx">The ifx.</param> /// <returns></returns> protected override Expression VisitIf(IFCommand ifx) { throw new NotSupportedException(); }