public void SaveChanges(DataTable table, ISqlAdapterCommands commands) { if (table == null) { throw new ArgumentNullException("table"); } if (commands == null) { throw new ArgumentNullException("commands"); } using (var connection = new SqlConnection(this.connectionString)) { connection.Open(); using (var adapter = new SqlDataAdapter()) { commands.SetCommands(adapter, connection); using (var dataSet = new DataSet()) { using (DataTable changes = table.GetChanges()) { if (changes != null) { dataSet.Tables.Add(changes); adapter.UpdateBatchSize = 1000; adapter.Update(dataSet, table.TableName); } } } } } }