开发者

Why do I need to call ISession.Flush after ISession.Delete

开发者 https://www.devze.com 2023-01-31 15:52 出处:网络
Why does NHibernate require me to flush the session after I delete? It does开发者_JAVA百科n\'t do need a flush after updating or saving.It does need to flush after updating or saving in addition to de

Why does NHibernate require me to flush the session after I delete? It does开发者_JAVA百科n't do need a flush after updating or saving.


It does need to flush after updating or saving in addition to delete. Your ISession's FlushMode setting or another factor (e.g. database generated identifiers) is causing it to flush automatically. The documentation describes the conditions that cause the session to be flushed.

In my opinion the best practice is to set the FlushMode to Commit and use transactions for all database operations, including reads (this is needed for 2nd level caching).

0

精彩评论

暂无评论...
验证码 换一张
取 消