public void UpdateRecords(IDbCommand command) { switch (command.GetType().Name) { case "SqlCommand": using (var mss = new MsSqlServer()) { mss.UpdateRecords(command); } break; case "MySqlCommand": using (var mys = new MySqlServer()) { mys.UpdateRecords(command); } break; case "OracleCommand": using (var os = new OracleServer()) { os.UpdateRecords(command); } break; case "NpgsqlCommand": using (var ps = new PostgresServer()) { ps.UpdateRecords(command); } break; default: throw new ArgumentOutOfRangeException(command.ToString()); } }