Esempio n. 1
0
        private void CreateData()
        {
            ISession s = OpenSession();
            s.Transaction.Begin();
            Driver driver = new Driver();
            driver.Delivery = new DateTime(2006, 10, 11);
            driver.Id = 1;
            driver.Name = "Emmanuel";
            driver.Score = 5;
            driver.Teacher = "andre";
            s.Save(driver);

            driver = new Driver();
            driver.Delivery = new DateTime(2007, 10, 11);
            driver.Id = 2;
            driver.Name = "Gavin";
            driver.Score = 3;
            driver.Teacher = "aaron";
            s.Save(driver);

            driver = new Driver();
            driver.Delivery = new DateTime(2004, 10, 11);
            driver.Id = 3;
            driver.Name = "Liz";
            driver.Score = 5;
            driver.Teacher = "max";
            s.Save(driver);
            s.Transaction.Commit();
            s.Close();
        }
Esempio n. 2
0
 private static void saveNewDriver(ISession session, int id, string name, string teacher, DateTime delivery, int score)
 {
     var driver = new Driver
     {
         Id = id,
         Name = name,
         Teacher = teacher,
         Delivery = delivery,
         Score = score
     };
     session.Save(driver);
 }