/// <summary> /// Translates the <paramref name="batchExpression"/> into a string representation. /// </summary> /// <param name="batchExpression">The <see cref="DbBatchExpression"/> to translate.</param> /// <returns><see cref="DbExpression"/></returns> protected virtual DbExpression VisitBatchExpression(DbBatchExpression batchExpression) { DbExpression[] originalList = batchExpression.ToArray(); var list = VisitListExpression(originalList); if (!ReferenceEquals(originalList, list)) { return(ExpressionFactory.Batch(list)); } return(batchExpression); }
/// <summary> /// Translates the <paramref name="batchExpression"/> into a string representation. /// </summary> /// <param name="batchExpression">The <see cref="DbBatchExpression"/> to translate.</param> /// <returns><see cref="string"/></returns> protected override DbExpression VisitBatchExpression(DbBatchExpression batchExpression) { if (batchExpression.Count() == 0) { return(ExpressionFactory.Sql(string.Empty)); } var sb = new StringBuilder(); foreach (var dbExpression in batchExpression) { sb.AppendFormat("{0};", Visit(dbExpression)); sb.AppendLine(); } return(ExpressionFactory.Sql(sb.ToString())); }
/// <summary> /// Translates the <paramref name="batchExpression"/> into a string representation. /// </summary> /// <param name="batchExpression">The <see cref="DbBatchExpression"/> to translate.</param> /// <returns><see cref="string"/></returns> protected override DbExpression VisitBatchExpression(DbBatchExpression batchExpression) { if (batchExpression.Count() == 0) return ExpressionFactory.Sql(string.Empty); var sb = new StringBuilder(); sb.AppendLine("begin "); foreach (var dbExpression in batchExpression) { sb.AppendFormat(1, "{0};", Visit(dbExpression)); sb.AppendLine(); } sb.AppendLine(" end;"); return ExpressionFactory.Sql(sb.ToString()); }
/// <summary> /// Translates the <paramref name="batchExpression"/> into a string representation. /// </summary> /// <param name="batchExpression">The <see cref="DbBatchExpression"/> to translate.</param> /// <returns><see cref="DbExpression"/></returns> protected virtual DbExpression VisitBatchExpression(DbBatchExpression batchExpression) { DbExpression[] originalList = batchExpression.ToArray(); var list = VisitListExpression(originalList); if (!ReferenceEquals(originalList, list)) return ExpressionFactory.Batch(list); return batchExpression; }