在this的問題,用戶要求更好的方式來關閉會議,因爲他有一些錯誤。關於NHibernate的ISession
最投票回答是Ayende的回答,說:
你應該總是使用session.Dispose();另一個是非常奇怪的發生
我應該真的總是打電話session.Dispose()
?撥打session.Close()
還不夠嗎?
在this的問題,用戶要求更好的方式來關閉會議,因爲他有一些錯誤。關於NHibernate的ISession
最投票回答是Ayende的回答,說:
你應該總是使用session.Dispose();另一個是非常奇怪的發生
我應該真的總是打電話session.Dispose()
?撥打session.Close()
還不夠嗎?
Session Dispose() does a couple more things than just Close()ing,所以是的,經常使用的Dispose()
規則在.NET經驗是 「如果類是IDisposable
隨時撥打Dispose
」,但更好的使用using