示例#1
0
文件: CrudDAL.cs 项目: TNLopes90/Chat
 public T Load(object aoKey)
 {
     using (ISession loSession = NHibernateConnection.OpenSession())
     {
         return(loSession.Get <T>(aoKey));
     }
 }
示例#2
0
文件: CrudDAL.cs 项目: TNLopes90/Chat
 public void Delete(T aoT)
 {
     using (ISession loSession = NHibernateConnection.OpenSession())
     {
         using (ITransaction loTransaction = loSession.BeginTransaction())
         {
             try
             {
                 loSession.Delete(aoT);
                 loTransaction.Commit();
             }
             catch (Exception ex)
             {
                 if (!loTransaction.WasCommitted)
                 {
                     loTransaction.Rollback();
                 }
                 throw new Exception("Fail to Delete" + ex.Message);
             }
         }
     }
 }