protected override int AddToBatch(IDbCommand command) { // the first time each command is asked to be batched, we ask // that command to prepare its batchable command text. We only want // to do this one time for each command MySqlCommand commandToBatch = (MySqlCommand)command; if (commandToBatch.BatchableCommandText == null) { commandToBatch.GetCommandTextForBatching(); } IDbCommand cloneCommand = (IDbCommand)((ICloneable)command).Clone(); commandBatch.Add(cloneCommand); return(commandBatch.Count - 1); }