NHibernate 3.0: TransactionScope and Auto-Flushing

后端 未结 4 730
一生所求
一生所求 2021-01-02 18:07

In NHibernate 3.0, FlushMode.Auto does not work when running under an ambient transaction only (that is, without starting an NHibernate transaction). Should it?

4条回答
  •  执念已碎
    2021-01-02 18:26

    For me, I don't know the reason behind, but by forcing session flush before session is disposed seemed to worked for me. e.g. using(session) { //do your work

    session.Flush(); }

    I verified that this works with my distributed transaction, since without doing this, I always get "transaction has aborted" when TransactionScope is disposed.

    Even set session.FlushMode to Commit did NOT work for me.

提交回复
热议问题