public static List <Specialty> GetAll() { List <Specialty> specialties = new List <Specialty> { }; MySqlConnection conn = DB.Connection(); conn.Open(); MySqlCommand cmd = conn.CreateCommand() as MySqlCommand; cmd.CommandText = @"SELECT * FROM Specialty;"; MySqlDataReader rdr = cmd.ExecuteReader() as MySqlDataReader; while (rdr.Read()) { Specialty specialty = new Specialty(); specialty.SetValuesFromReader(rdr); specialties.Add(specialty); } rdr.Close(); foreach (var specialty in specialties) { specialty.PopulateStylists(conn); } conn.Close(); if (conn != null) { conn.Dispose(); } return(specialties); }