public void GetClubsAndFigureSkaters() { using (ISession session = HibernateHelper.OpenSession()) { var criteria = session.CreateCriteria <Club>(); var clubs = criteria.List <Club>(); System.Console.WriteLine(); foreach (var cl in clubs) { System.Console.WriteLine("{0}: {1}", cl.ClubId, cl.Name); foreach (var fs in cl.FigureSkaters) { System.Console.WriteLine(" {0}: {1} {2}, {3} years old", fs.FigureSkaterId, fs.FirstName, fs.LastName, fs.Age); } } } }
public void GetClubs() { using (ISession session = HibernateHelper.OpenSession()) { using (ITransaction transaction = session.BeginTransaction()) { var criteria = session.CreateCriteria <Club>(); var clubs = criteria.List <Club>(); System.Console.WriteLine(); System.Console.WriteLine("Club Id Name Location"); foreach (var cl in clubs) { System.Console.WriteLine("{0}: {1} || {2}, {3}", cl.ClubId, cl.Name, cl.City, cl.Country); } } } }