public ISQLinqResult ToSQL(int existingParameterCount = 0, string parameterNamePrefix = SqlExpressionCompiler.DefaultParameterNamePrefix) { var paramCount = existingParameterCount; var result = new SQLinqIfResult { Operator = this.Operator }; if (this.If is string) { result.If = this.If as string; } else { var ifResult = ((ISQLinq)this.If).ToSQL(paramCount, parameterNamePrefix); result.If = ifResult.ToQuery(); foreach (var p in ifResult.Parameters) { result.Parameters.Add(p); } paramCount = existingParameterCount + result.Parameters.Count; } if (this.Then != null) { var thenResult = this.Then.ToSQL(paramCount, parameterNamePrefix); result.Then = thenResult.ToQuery(); foreach (var p in thenResult.Parameters) { result.Parameters.Add(p); } paramCount = existingParameterCount + result.Parameters.Count; } if (this.Else != null) { var elseResult = this.Else.ToSQL(paramCount, parameterNamePrefix); result.Else = elseResult.ToQuery(); foreach (var p in elseResult.Parameters) { result.Parameters.Add(p); } } return result; }
public ISQLinqResult ToSQL(int existingParameterCount = 0, string parameterNamePrefix = SqlExpressionCompiler.DefaultParameterNamePrefix) { var paramCount = existingParameterCount; var result = new SQLinqIfResult { Operator = this.Operator }; if (this.If is string) { result.If = this.If as string; } else { var ifResult = ((ISQLinq)this.If).ToSQL(paramCount, parameterNamePrefix); result.If = ifResult.ToQuery(); foreach (var p in ifResult.Parameters) { result.Parameters.Add(p); } paramCount = existingParameterCount + result.Parameters.Count; } if (this.Then != null) { var thenResult = this.Then.ToSQL(paramCount, parameterNamePrefix); result.Then = thenResult.ToQuery(); foreach (var p in thenResult.Parameters) { result.Parameters.Add(p); } paramCount = existingParameterCount + result.Parameters.Count; } if (this.Else != null) { var elseResult = this.Else.ToSQL(paramCount, parameterNamePrefix); result.Else = elseResult.ToQuery(); foreach (var p in elseResult.Parameters) { result.Parameters.Add(p); } } return(result); }