NHibernate with TransactionScope

前端 未结 6 1522
闹比i
闹比i 2020-12-02 18:25

Can anyone give me a quick overview of using TransactionScope with NHibernate? Do I need to do anything special with the session/IEnlistmentNotification/etc. to get this to

6条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-02 19:27

    I've testing this out using varying vendors and it just works. If you don't have "scope.Complete()" then the transaction will roll back. You may need to have MSDTC running the machine(s) involved if there is more than one durable resource. In that case MSDTC will automatically detect the ambient ADO.NET transactions and manage the whole thing.

提交回复
热议问题