예제 #1
0
 public IList <T> GetAll <T>() where T : class
 {
     using (var session = NHibernateSessionHelper.OpenSession())
     {
         if (null == session)
         {
             return(new List <T>());
         }
         using (session.BeginTransaction())
         {
             return(session.QueryOver <T>().List());
         }
     }
 }
예제 #2
0
 public void Add <T>(T obj)
 {
     using (var session = NHibernateSessionHelper.OpenSession())
     {
         if (null == session)
         {
             return;
         }
         using (var transaction = session.BeginTransaction())
         {
             session.Save(obj);
             transaction.Commit();
         }
     }
 }