using NHibernate;
using NHibernate.Cfg;

namespace Console {
    class Program {
        static void Main() {
            Configuration cfg = new Configuration();
            cfg.Configure();
            ISessionFactory sessionFactory = cfg.BuildSessionFactory();
            using(ISession session = sessionFactory.OpenSession())
            using(ITransaction tx = session.BeginTransaction()) {
                Customer customer = session.Load<Customer>("ALFKI");
                System.Console.WriteLine("{0}: {1} ({2})", customer.Id, customer.CompanyName, customer.Address);

                Employee emp = session.Get<Employee>(5);
                System.Console.WriteLine("{0} {1}", emp.GivenName, emp.SurName);
                tx.Commit();
            }
            System.Console.ReadLine();
        }
    }

    public class Customer {
        public string Id { get; set; }
        public string CompanyName { get; set; }
        public string Address { get; set; }
    }
}
