110,500
社区成员
发帖
与我相关
我的任务
分享
public void delete(object entity)
{
ISession session = GetCurrentSession();
using (ITransaction tx = session.BeginTransaction())
{
try
{
session.Delete(entity);
tx.Commit();
}catch (HibernateException)
{
tx.Rollback();
throw;
}
}
}
TransactionScope trans = null;
try {
trans = new TransactionScope();
// 逻辑段
trans.Complete();
} catch(Exception ex) {
throw ex;
} finally {
if (trans != null) {
trans.Dispose();
}
}