Esempio n. 1
0
 public IList <T> RestoreAll()
 {
     using (ISession session = FluentSessionFactory.OpenSession())
     {
         try
         {
             return(session.Query <T>().ToList());;
         }
         catch (Exception e)
         {
             throw e;
         }
     }
 }
Esempio n. 2
0
 public T Restore(int id)
 {
     using (ISession session = FluentSessionFactory.OpenSession())
     {
         try
         {
             return(session.Get <T>(id));
         }
         catch (Exception e)
         {
             throw e;
         }
     }
 }
Esempio n. 3
0
 public void Update(T entity)
 {
     using (ISession session = FluentSessionFactory.OpenSession())
     {
         using (ITransaction trans = session.BeginTransaction())
         {
             try
             {
                 session.Update(entity);
                 trans.Commit();
             }
             catch (Exception e)
             {
                 trans.Rollback();
                 throw e;
             }
         }
     }
 }