Пример #1
0
 protected void OpenSession()
 {
     if (_session == null)
     {
         _session = HibernateConfiguration.GetSession();
     }
     else if (!_session.IsOpen)
     {
         _session = HibernateConfiguration.GetSession();
     }
 }
Пример #2
0
 public void TestDbAccess()
 {
     using (var session = HibernateConfiguration.GetSession())
     {
         var d    = new Discipline();
         var repo = new DisciplineRepository();
         d.Name = "Football";
         if (!repo.ContainsName(d.Name))
         {
             repo.SaveOrUpdate(d);
         }
         var result = repo.GetAll();
         Assert.IsTrue(result.Count > 0);
     }
 }