Exemplo n.º 1
0
 public static T GetEntity <T>(int id) where T : Entity
 {
     using (ISession s =
                UserSessionFactory.GetSessionFactory().OpenSession())
     {
         return(s.Get <T>(id));
     }
 }
Exemplo n.º 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();
         }
 }
Exemplo n.º 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();
         }
 }