Beispiel #1
0
 public static T GetEntity <T>(int id) where T : Entity
 {
     using (ISession s =
                UserSessionFactory.GetSessionFactory().OpenSession())
     {
         return(s.Get <T>(id));
     }
 }
Beispiel #2
0
 public static void UpsertEntity <T>(T entity) where T : Entity
 {
     using (ISession s =
                UserSessionFactory.GetSessionFactory().OpenSession())
         using (ITransaction tx = s.BeginTransaction())
         {
             s.SaveOrUpdate(entity);
             tx.Commit();
         }
 }
Beispiel #3
0
 public static void DeleteEntity <T>(T toDelete) where T : Entity
 {
     using (ISession s =
                UserSessionFactory.GetSessionFactory().OpenSession())
         using (ITransaction tx = s.BeginTransaction())
         {
             s.Delete(toDelete);
             tx.Commit();
         }
 }