From: <aye...@us...> - 2009-03-24 10:59:06
|
Revision: 4151 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4151&view=rev Author: ayenderahien Date: 2009-03-24 10:59:04 +0000 (Tue, 24 Mar 2009) Log Message: ----------- implementing a fix to flush during prepared event in escalated DTC tx Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Impl/AbstractSessionImpl.cs Modified: trunk/nhibernate/src/NHibernate/Impl/AbstractSessionImpl.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Impl/AbstractSessionImpl.cs 2009-03-22 17:56:16 UTC (rev 4150) +++ trunk/nhibernate/src/NHibernate/Impl/AbstractSessionImpl.cs 2009-03-24 10:59:04 UTC (rev 4151) @@ -260,14 +260,19 @@ { try { - BeforeTransactionCompletion(null); - if (FlushMode != FlushMode.Never) + using(var tx = new TransactionScope(ambientTransation)) { - using (ConnectionManager.FlushingFromDtcTransaction) - Flush(); - } - preparingEnlistment.Prepared(); - logger.Debug("prepared for DTC transaction"); + BeforeTransactionCompletion(null); + if (FlushMode != FlushMode.Never) + { + using (ConnectionManager.FlushingFromDtcTransaction) + Flush(); + } + logger.Debug("prepared for DTC transaction"); + + tx.Complete(); + } + preparingEnlistment.Prepared(); } catch (Exception exception) { @@ -315,7 +320,7 @@ if (shouldCloseSessionOnDtcTransactionCompleted) Dispose(true); }; - ambientTransation.EnlistVolatile(this, EnlistmentOptions.None); + ambientTransation.EnlistVolatile(this, EnlistmentOptions.EnlistDuringPrepareRequired); } protected abstract void Dispose(bool disposing); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |