public string GenerateDelete(ICollection <DbDeleteCommandTree> commandTrees, string rowsAffectedParameter) { DebugCheck.NotNull(commandTrees); List <SqlParameter> _; var sql = new StringBuilder(); sql.AppendLine( DmlSqlGenerator.GenerateDeleteSql( commandTrees.First(), _sqlGenerator, out _)); sql.AppendLine(); foreach (var commandTree in commandTrees.Skip(1)) { sql.AppendLine( DmlSqlGenerator.GenerateDeleteSql( commandTree, _sqlGenerator, out _)); sql.AppendLine("AND @@ROWCOUNT > 0"); sql.AppendLine(); } AppendSetRowsAffected(sql, rowsAffectedParameter); return(sql.ToString().TrimEnd()); }
public string GenerateDelete( ICollection <DbDeleteCommandTree> commandTrees, string rowsAffectedParameter) { StringBuilder sql = new StringBuilder(); List <SqlParameter> parameters; sql.AppendLine(DmlSqlGenerator.GenerateDeleteSql(commandTrees.First <DbDeleteCommandTree>(), this._sqlGenerator, out parameters, true, true)); sql.AppendLine(); foreach (DbDeleteCommandTree tree in commandTrees.Skip <DbDeleteCommandTree>(1)) { sql.AppendLine(DmlSqlGenerator.GenerateDeleteSql(tree, this._sqlGenerator, out parameters, true, true)); sql.AppendLine("AND @@ROWCOUNT > 0"); sql.AppendLine(); } DmlFunctionSqlGenerator.AppendSetRowsAffected(sql, rowsAffectedParameter); return(sql.ToString().TrimEnd()); }