internal override void Execute(ConfigurationElementCollection collection) { if (!(collection is OracleSettingsCollection)) { throw new ArgumentException("setting must be a OracleSettingsCollection"); } foreach (var settings in collection.Cast<OracleSettings>()) { using (var connection = GetConnection(ConnectionStringTemplate, settings.TnsData, settings.UserID, settings.Password)) { connection.Open(); Console.WriteLine("Executing commands on " + settings); int count = ExecuteCommandsFromTemplate(connection, CreateDropTableCommandString); count += ExecuteCommandsFromTemplate(connection, CreateDropIndexCommandString); count += ExecuteCommandsFromTemplate(connection, CreateDropSequenceCommandString); count += ExecuteCommandsFromTemplate(connection, CreateDropTriggerString); Console.WriteLine("Finished executing commands. There were {0} operations.", count); if (count > 0) { Console.WriteLine("Purging recycle bin"); ExecuteNonQuery(connection, PurgeRecycleBin); } connection.Close(); } } Console.Write("Press any key to continue . . . "); Console.ReadKey(true); }
internal override void Execute(ConfigurationElementCollection collection) { if (!(collection is MsSqlSettingsCollection)) { throw new ArgumentException("collection must be a MsSqlSettingsCollection"); } foreach (var settings in collection.Cast<MsSqlSettings>()) { using (var connection = GetConnection(ConnectionStringTemplate, settings.DataSource, settings.Catalog, settings.UserID, settings.Password)) { connection.Open(); Console.WriteLine("Executing commands on " + settings); int count = ExecuteCommandsFromTemplate(connection, CreateDropTableCommandString); Console.WriteLine("Finished executing commands. There were {0} operations.", count); connection.Close(); } } Console.Write("Press any key to continue . . . "); Console.ReadKey(true); }