public T Load(object aoKey) { using (ISession loSession = NHibernateConnection.OpenSession()) { return(loSession.Get <T>(aoKey)); } }
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); } } } }