NHibernate所有的異常處理都派生自HibernateException類
HibernateException類派生自系統的ApplicationException類
The exception that is thrown when a non
拋出一個非致命的程序異常
系統中很多異常處理類
看看NHibernate在事務提交時的異常處理方法
public void Commit()
{
using (new SessionIdLoggingContext(sessionId))
{
CheckNotDisposed();
CheckBegun();
CheckNotZombied();
log
if (session
{
session
}
NotifyLocalSynchsBeforeTransactionCompletion();
session
try
{
trans
log
committed = true;
AfterTransactionCompletion(true);
Dispose();
}
catch (HibernateException e)
{
log
AfterTransactionCompletion(false);
commitFailed = true;
// Don
throw;
}
catch (Exception e)
{
log
AfterTransactionCompletion(false);
commitFailed = true;
throw new TransactionException(
}
finally
{
CloseIfRequired();
}
}
}
其中 Don
同類就throw
另外不好的地方就是
From:http://tw.wingwit.com/Article/program/net/201311/13778.html