From: <aye...@us...> - 2009-05-22 20:42:36
|
Revision: 4360 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4360&view=rev Author: ayenderahien Date: 2009-05-22 20:42:29 +0000 (Fri, 22 May 2009) Log Message: ----------- First part of the Transaction Factory work, created an AdoNetWithDistrubtedTransactionFactory factory that now encapsulate all the interaction with the DTC AdoNetWithDistrubtedTransactionFactory is now the default transaction factory If a user wants to avoid paying the price of DTC checks, it can be done by specifying AdoNetTransactionFactory in the configuration Modified Paths: -------------- trunk/nhibernate/src/NHibernate/AdoNet/ConnectionManager.cs trunk/nhibernate/src/NHibernate/Cfg/SettingsFactory.cs trunk/nhibernate/src/NHibernate/Engine/ISessionImplementor.cs trunk/nhibernate/src/NHibernate/Impl/AbstractSessionImpl.cs trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs trunk/nhibernate/src/NHibernate/Impl/StatelessSessionImpl.cs trunk/nhibernate/src/NHibernate/NHibernate.csproj trunk/nhibernate/src/NHibernate/Transaction/AdoNetTransactionFactory.cs trunk/nhibernate/src/NHibernate/Transaction/ITransactionContext.cs trunk/nhibernate/src/NHibernate/Transaction/ITransactionFactory.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1054/DummyTransactionFactory.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1054/NH1054Fixture.cs Added Paths: ----------- trunk/nhibernate/src/NHibernate/Transaction/AdoNetWithDistrubtedTransactionFactory.cs Removed Paths: ------------- trunk/nhibernate/src/NHibernate/AdoNet/AdoNetContext.cs Deleted: trunk/nhibernate/src/NHibernate/AdoNet/AdoNetContext.cs =================================================================== --- trunk/nhibernate/src/NHibernate/AdoNet/AdoNetContext.cs 2009-05-22 18:35:26 UTC (rev 4359) +++ trunk/nhibernate/src/NHibernate/AdoNet/AdoNetContext.cs 2009-05-22 20:42:29 UTC (rev 4360) @@ -1,59 +0,0 @@ -using System; -using log4net; -using NHibernate.Transaction; - -namespace NHibernate.AdoNet -{ - [Serializable] - public class AdoNetContext : ConnectionManager.Callback - { - // TODO : make this the factory for "entity mode related" sessions; - // also means making this the target of transaction-synch and the - // thing that knows how to cascade things between related sessions - // - // At that point, perhaps this thing is a "SessionContext", and - // ConnectionManager is a "JDBCContext"? A "SessionContext" should - // live in the impl package... - - //private IContext owner; - //private ConnectionManager connectionManager; - //[NonSerialized] - //private bool isTransactionCallbackRegistered; - //[NonSerialized] - //private ITransaction hibernateTransaction; - - private static readonly ILog log = LogManager.GetLogger(typeof (AdoNetContext)); - - public interface IContext : ITransactionContext - { - /** - * We cannot rely upon this method being called! It is only - * called if we are using Hibernate Transaction API. - */ - ConnectionReleaseMode ConnectionReleaseMode { get; } - bool IsAutoCloseSessionEnabled { get; } - void AfterTransactionBegin(ITransaction tx); - void BeforeTransactionCompletion(ITransaction tx); - void AfterTransactionCompletion(bool success, ITransaction tx); - } - - #region Callback Members - - public void ConnectionOpened() - { - throw new NotImplementedException(); - } - - public void ConnectionCleanedUp() - { - throw new NotImplementedException(); - } - - public bool IsTransactionInProgress - { - get { throw new NotImplementedException(); } - } - - #endregion - } -} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/AdoNet/ConnectionManager.cs =================================================================== --- trunk/nhibernate/src/NHibernate/AdoNet/ConnectionManager.cs 2009-05-22 18:35:26 UTC (rev 4359) +++ trunk/nhibernate/src/NHibernate/AdoNet/ConnectionManager.cs 2009-05-22 20:42:29 UTC (rev 4360) @@ -66,9 +66,9 @@ { get { - if (System.Transactions.Transaction.Current != null) + if (transaction != null && transaction.IsActive) return true; - return transaction != null && transaction.IsActive; + return session.Factory.TransactionFactory.IsInDistributedActiveTransaction(session); } } Modified: trunk/nhibernate/src/NHibernate/Cfg/SettingsFactory.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/SettingsFactory.cs 2009-05-22 18:35:26 UTC (rev 4359) +++ trunk/nhibernate/src/NHibernate/Cfg/SettingsFactory.cs 2009-05-22 20:42:29 UTC (rev 4360) @@ -346,7 +346,7 @@ private static ITransactionFactory CreateTransactionFactory(IDictionary<string, string> properties) { string className = PropertiesHelper.GetString( - Environment.TransactionStrategy, properties, typeof(AdoNetTransactionFactory).FullName); + Environment.TransactionStrategy, properties, typeof(AdoNetWithDistrubtedTransactionFactory).FullName); log.Info("Transaction factory: " + className); try Modified: trunk/nhibernate/src/NHibernate/Engine/ISessionImplementor.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Engine/ISessionImplementor.cs 2009-05-22 18:35:26 UTC (rev 4359) +++ trunk/nhibernate/src/NHibernate/Engine/ISessionImplementor.cs 2009-05-22 20:42:29 UTC (rev 4360) @@ -10,6 +10,7 @@ using NHibernate.Impl; using NHibernate.Loader.Custom; using NHibernate.Persister.Entity; +using NHibernate.Transaction; using NHibernate.Type; namespace NHibernate.Engine @@ -290,5 +291,9 @@ FutureQueryBatch FutureQueryBatch { get; } Guid SessionId { get; } + + ITransactionContext TransactionContext { get; set; } + + void CloseSessionFromDistributedTransaction(); } } Modified: trunk/nhibernate/src/NHibernate/Impl/AbstractSessionImpl.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Impl/AbstractSessionImpl.cs 2009-05-22 18:35:26 UTC (rev 4359) +++ trunk/nhibernate/src/NHibernate/Impl/AbstractSessionImpl.cs 2009-05-22 20:42:29 UTC (rev 4360) @@ -13,6 +13,7 @@ using NHibernate.Hql; using NHibernate.Loader.Custom; using NHibernate.Persister.Entity; +using NHibernate.Transaction; using NHibernate.Type; namespace NHibernate.Impl @@ -21,16 +22,20 @@ /// <summary> Functionality common to stateless and stateful sessions </summary> [Serializable] - public abstract class AbstractSessionImpl : ISessionImplementor, IEnlistmentNotification + public abstract class AbstractSessionImpl : ISessionImplementor { [NonSerialized] private ISessionFactoryImplementor factory; private readonly Guid sessionId = Guid.NewGuid(); private bool closed; - private System.Transactions.Transaction ambientTransation; + + public ITransactionContext TransactionContext + { + get; set; + } + private bool isAlreadyDisposed; - protected bool shouldCloseSessionOnDtcTransactionCompleted; private static readonly ILog logger = LogManager.GetLogger(typeof(AbstractSessionImpl)); @@ -39,14 +44,6 @@ get { return sessionId; } } - protected bool TakingPartInDtcTransaction - { - get - { - return ambientTransation != null; - } - } - internal AbstractSessionImpl() { } protected internal AbstractSessionImpl(ISessionFactoryImplementor factory) @@ -77,7 +74,7 @@ public abstract EntityMode EntityMode { get; } public abstract IBatcher Batcher { get; } - + public abstract void CloseSessionFromDistributedTransaction(); public abstract IList List(string query, QueryParameters parameters); public abstract void List(string query, QueryParameters parameters, IList results); public abstract IList<T> List<T>(string query, QueryParameters queryParameters); @@ -214,8 +211,8 @@ { try { - if (ambientTransation != null) - ambientTransation.Dispose(); + if (TransactionContext != null) + TransactionContext.Dispose(); } catch (Exception) { @@ -307,106 +304,12 @@ } } - #region IEnlistmentNotification Members - - void IEnlistmentNotification.Prepare(PreparingEnlistment preparingEnlistment) - { - using (new SessionIdLoggingContext(SessionId)) - { - try - { - using (var tx = new TransactionScope(ambientTransation)) - { - BeforeTransactionCompletion(null); - if (FlushMode != FlushMode.Never && ConnectionManager.IsConnected) - { - using (ConnectionManager.FlushingFromDtcTransaction) - { - logger.Debug(string.Format("[session-id={0}] Flushing from Dtc Transaction", sessionId)); - Flush(); - } - } - logger.Debug("prepared for DTC transaction"); - - tx.Complete(); - } - preparingEnlistment.Prepared(); - } - catch (Exception exception) - { - logger.Error("DTC transaction prepre phase failed", exception); - preparingEnlistment.ForceRollback(exception); - } - } - } - - void IEnlistmentNotification.Commit(Enlistment enlistment) - { - using (new SessionIdLoggingContext(SessionId)) - { - logger.Debug("committing DTC transaction"); - // we have nothing to do here, since it is the actual - // DB connection that will commit the transaction - enlistment.Done(); - } - } - - void IEnlistmentNotification.Rollback(Enlistment enlistment) - { - using (new SessionIdLoggingContext(SessionId)) - { - AfterTransactionCompletion(false, null); - logger.Debug("rolled back DTC transaction"); - enlistment.Done(); - } - } - - void IEnlistmentNotification.InDoubt(Enlistment enlistment) - { - using (new SessionIdLoggingContext(SessionId)) - { - AfterTransactionCompletion(false, null); - logger.Debug("DTC transaction is in doubt"); - enlistment.Done(); - } - } - protected void EnlistInAmbientTransactionIfNeeded() { using (new SessionIdLoggingContext(SessionId)) { - if (ambientTransation != null) - return; - if (System.Transactions.Transaction.Current == null) - return; - ambientTransation = System.Transactions.Transaction.Current.Clone(); - logger.DebugFormat("enlisted into DTC transaction: {0}", ambientTransation.IsolationLevel); - AfterTransactionBegin(null); - ambientTransation.TransactionCompleted += delegate(object sender, TransactionEventArgs e) - { - bool wasSuccessful = false; - try - { - wasSuccessful = e.Transaction.TransactionInformation.Status - == TransactionStatus.Committed; - } - catch (ObjectDisposedException ode) - { - logger.Warn("Completed transaction was disposed.", ode); - } - AfterTransactionCompletion(wasSuccessful, null); - if (shouldCloseSessionOnDtcTransactionCompleted) - { - Dispose(true); - } - ambientTransation = null; - }; - ambientTransation.EnlistVolatile(this, EnlistmentOptions.EnlistDuringPrepareRequired); + factory.TransactionFactory.EnlistInDistributedTransactionIfNeeded(this); } } - - protected abstract void Dispose(bool disposing); - - #endregion } } Modified: trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs 2009-05-22 18:35:26 UTC (rev 4359) +++ trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs 2009-05-22 20:42:29 UTC (rev 4360) @@ -579,6 +579,11 @@ } } + public override void CloseSessionFromDistributedTransaction() + { + Dispose(true); + } + public override IList List(string query, QueryParameters parameters) { using (new SessionIdLoggingContext(SessionId)) @@ -1655,9 +1660,9 @@ using (new SessionIdLoggingContext(SessionId)) { log.Debug(string.Format("[session-id={0}] running ISession.Dispose()", SessionId)); - if (TakingPartInDtcTransaction) + if (TransactionContext!=null) { - shouldCloseSessionOnDtcTransactionCompleted = true; + TransactionContext.ShouldCloseSessionOnDistributedTransactionCompleted = true; return; } Dispose(true); @@ -1673,7 +1678,7 @@ /// If this Session is being Finalized (<c>isDisposing==false</c>) then make sure not /// to call any methods that could potentially bring this Session back to life. /// </remarks> - protected override void Dispose(bool isDisposing) + protected void Dispose(bool isDisposing) { using (new SessionIdLoggingContext(SessionId)) { @@ -1689,7 +1694,7 @@ // know this call came through Dispose() if (isDisposing && !IsClosed) { - Close(); + Close(); } // free unmanaged resources here Modified: trunk/nhibernate/src/NHibernate/Impl/StatelessSessionImpl.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Impl/StatelessSessionImpl.cs 2009-05-22 18:35:26 UTC (rev 4359) +++ trunk/nhibernate/src/NHibernate/Impl/StatelessSessionImpl.cs 2009-05-22 20:42:29 UTC (rev 4360) @@ -87,6 +87,11 @@ } } + public override void CloseSessionFromDistributedTransaction() + { + Dispose(true); + } + public override IList List(string query, QueryParameters parameters) { using (new SessionIdLoggingContext(SessionId)) @@ -883,16 +888,16 @@ using (new SessionIdLoggingContext(SessionId)) { log.Debug("running IStatelessSession.Dispose()"); - if (TakingPartInDtcTransaction) + if (TransactionContext != null) { - shouldCloseSessionOnDtcTransactionCompleted = true; + TransactionContext .ShouldCloseSessionOnDistributedTransactionCompleted = true; return; } Dispose(true); } } - protected override void Dispose(bool isDisposing) + protected void Dispose(bool isDisposing) { using (new SessionIdLoggingContext(SessionId)) { Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-05-22 18:35:26 UTC (rev 4359) +++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-05-22 20:42:29 UTC (rev 4360) @@ -435,7 +435,6 @@ <Compile Include="Action\EntityInsertAction.cs" /> <Compile Include="Action\EntityUpdateAction.cs" /> <Compile Include="Action\IExecutable.cs" /> - <Compile Include="AdoNet\AdoNetContext.cs" /> <Compile Include="AdoNet\ColumnNameCache.cs" /> <Compile Include="AdoNet\Expectations.cs" /> <Compile Include="AdoNet\IBatcherFactory.cs" /> @@ -599,6 +598,7 @@ <Compile Include="Hql\Ast\ANTLR\Util\NodeTraverser.cs" /> <Compile Include="Param\VersionTypeSeedParameterSpecification.cs" /> <Compile Include="SqlCommand\InsertSelect.cs" /> + <Compile Include="Transaction\AdoNetWithDistrubtedTransactionFactory.cs" /> <Compile Include="Transform\ToListResultTransformer.cs" /> <Compile Include="Util\NullableDictionary.cs" /> <Compile Include="Hql\Ast\ANTLR\Util\PathHelper.cs" /> Modified: trunk/nhibernate/src/NHibernate/Transaction/AdoNetTransactionFactory.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Transaction/AdoNetTransactionFactory.cs 2009-05-22 18:35:26 UTC (rev 4359) +++ trunk/nhibernate/src/NHibernate/Transaction/AdoNetTransactionFactory.cs 2009-05-22 20:42:29 UTC (rev 4360) @@ -1,5 +1,4 @@ using System.Collections; -using NHibernate.AdoNet; using NHibernate.Engine; namespace NHibernate.Transaction @@ -11,19 +10,18 @@ return new AdoTransaction(session); } - public void Configure(IDictionary props) + public void EnlistInDistributedTransactionIfNeeded(ISessionImplementor session) { + // nothing need to do here, we only support local transactions with this factory } - public ConnectionReleaseMode DefaultReleaseMode + public bool IsInDistributedActiveTransaction(ISessionImplementor session) { - get { throw new System.NotImplementedException(); } + return false; } - public bool IsTransactionInProgress(AdoNetContext adoNetContext, ITransactionContext transactionContext, - ITransaction transaction) + public void Configure(IDictionary props) { - throw new System.NotImplementedException(); } } } \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Transaction/AdoNetWithDistrubtedTransactionFactory.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Transaction/AdoNetWithDistrubtedTransactionFactory.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Transaction/AdoNetWithDistrubtedTransactionFactory.cs 2009-05-22 20:42:29 UTC (rev 4360) @@ -0,0 +1,153 @@ +using System; +using System.Collections; +using System.Transactions; +using log4net; +using NHibernate.Engine; +using NHibernate.Impl; + +namespace NHibernate.Transaction +{ + public class AdoNetWithDistrubtedTransactionFactory : ITransactionFactory + { + private static readonly ILog logger = LogManager.GetLogger(typeof (AbstractSessionImpl)); + + public void Configure(IDictionary props) + { + + } + + public ITransaction CreateTransaction(ISessionImplementor session) + { + return new AdoTransaction(session); + } + + public void EnlistInDistributedTransactionIfNeeded(ISessionImplementor session) + { + if (session.TransactionContext != null) + return; + if (System.Transactions.Transaction.Current == null) + return; + var transactionContext = new DistributedTransactionContext(session, System.Transactions.Transaction.Current); + session.TransactionContext = transactionContext; + logger.DebugFormat("enlisted into DTC transaction: {0}", transactionContext.AmbientTransation.IsolationLevel); + session.AfterTransactionBegin(null); + transactionContext.AmbientTransation.TransactionCompleted += delegate(object sender, TransactionEventArgs e) + { + bool wasSuccessful = false; + try + { + wasSuccessful = e.Transaction.TransactionInformation.Status + == TransactionStatus.Committed; + } + catch (ObjectDisposedException ode) + { + logger.Warn("Completed transaction was disposed, assuming transaction rollback", ode); + } + session.AfterTransactionCompletion(wasSuccessful, null); + if (transactionContext.ShouldCloseSessionOnDistributedTransactionCompleted) + { + session.CloseSessionFromDistributedTransaction(); + } + session.TransactionContext = null; + }; + transactionContext.AmbientTransation.EnlistVolatile(transactionContext, EnlistmentOptions.EnlistDuringPrepareRequired); + } + + public bool IsInDistributedActiveTransaction(ISessionImplementor session) + { + var distributedTransactionContext = ((DistributedTransactionContext) session.TransactionContext); + return distributedTransactionContext != null && + distributedTransactionContext.IsInActiveTransaction; + } + + public class DistributedTransactionContext : ITransactionContext, IEnlistmentNotification + { + public System.Transactions.Transaction AmbientTransation { get; set; } + public bool ShouldCloseSessionOnDistributedTransactionCompleted { get; set; } + private readonly ISessionImplementor sessionImplementor; + public bool IsInActiveTransaction; + + public DistributedTransactionContext(ISessionImplementor sessionImplementor, System.Transactions.Transaction transaction) + { + this.sessionImplementor = sessionImplementor; + AmbientTransation = transaction.Clone(); + IsInActiveTransaction = true; + } + + #region IEnlistmentNotification Members + + void IEnlistmentNotification.Prepare(PreparingEnlistment preparingEnlistment) + { + using (new SessionIdLoggingContext(sessionImplementor.SessionId)) + { + try + { + using (var tx = new TransactionScope(AmbientTransation)) + { + sessionImplementor.BeforeTransactionCompletion(null); + if (sessionImplementor.FlushMode != FlushMode.Never && sessionImplementor.ConnectionManager.IsConnected) + { + using (sessionImplementor.ConnectionManager.FlushingFromDtcTransaction) + { + logger.Debug(string.Format("[session-id={0}] Flushing from Dtc Transaction", sessionImplementor.SessionId)); + sessionImplementor.Flush(); + } + } + logger.Debug("prepared for DTC transaction"); + + tx.Complete(); + } + preparingEnlistment.Prepared(); + } + catch (Exception exception) + { + logger.Error("DTC transaction prepre phase failed", exception); + preparingEnlistment.ForceRollback(exception); + } + } + } + + void IEnlistmentNotification.Commit(Enlistment enlistment) + { + using (new SessionIdLoggingContext(sessionImplementor.SessionId)) + { + logger.Debug("committing DTC transaction"); + // we have nothing to do here, since it is the actual + // DB connection that will commit the transaction + enlistment.Done(); + IsInActiveTransaction = false; + } + } + + void IEnlistmentNotification.Rollback(Enlistment enlistment) + { + using (new SessionIdLoggingContext(sessionImplementor.SessionId)) + { + sessionImplementor.AfterTransactionCompletion(false, null); + logger.Debug("rolled back DTC transaction"); + enlistment.Done(); + IsInActiveTransaction = false; + } + } + + void IEnlistmentNotification.InDoubt(Enlistment enlistment) + { + using (new SessionIdLoggingContext(sessionImplementor.SessionId)) + { + sessionImplementor.AfterTransactionCompletion(false, null); + logger.Debug("DTC transaction is in doubt"); + enlistment.Done(); + IsInActiveTransaction = false; + } + } + + #endregion + + public void Dispose() + { + if (AmbientTransation != null) + AmbientTransation.Dispose(); + } + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/Transaction/ITransactionContext.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Transaction/ITransactionContext.cs 2009-05-22 18:35:26 UTC (rev 4359) +++ trunk/nhibernate/src/NHibernate/Transaction/ITransactionContext.cs 2009-05-22 20:42:29 UTC (rev 4360) @@ -1,3 +1,4 @@ +using System; using NHibernate.Engine; namespace NHibernate.Transaction @@ -2,18 +3,9 @@ { - public interface ITransactionContext + /// <summary> + /// This is used as a marker interface for the different + /// transaction context required for each session + /// </summary> + public interface ITransactionContext : IDisposable { - /// Since C# doesn't support interfaces into interfaces ITransactionContext - /// represent the inner interface at - /// org.hibernate.transaction.TransactionFactory.Context - - ISessionFactoryImplementor Factory { get; } - //bool IsOpen { get; } - bool IsClosed { get; } - - bool IsFlushModeNever { get; } - bool IsFlushBeforeCompletionEnabled { get; } - void ManagedFlush(); - - bool ShouldAutoClose { get; } - void ManagedClose(); + bool ShouldCloseSessionOnDistributedTransactionCompleted { get; set; } } Modified: trunk/nhibernate/src/NHibernate/Transaction/ITransactionFactory.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Transaction/ITransactionFactory.cs 2009-05-22 18:35:26 UTC (rev 4359) +++ trunk/nhibernate/src/NHibernate/Transaction/ITransactionFactory.cs 2009-05-22 20:42:29 UTC (rev 4360) @@ -1,4 +1,5 @@ using System.Collections; +using System.Transactions; using NHibernate; using NHibernate.AdoNet; using NHibernate.Engine; @@ -26,25 +27,8 @@ /// </summary> ITransaction CreateTransaction(ISessionImplementor session); - /// <summary> - /// Get the default connection release mode - /// </summary> - ConnectionReleaseMode DefaultReleaseMode { get; } + void EnlistInDistributedTransactionIfNeeded(ISessionImplementor session); - //TODO: do we need this? - //bool IsTransactionManagerRequired { get; } - - //TODO: do we need this? - //bool AreCallbacksLocalToHibernateTransactions { get; } - - /// <summary> - /// Determine whether an underlying transaction is in progress. - /// - /// Mainly this is used in determining whether to register a - /// synchronization as well as whether or not to circumvent - /// auto flushing outside transactions. - /// </summary> - /// <returns>true if an underlying transaction is know to be in effect.</returns> - bool IsTransactionInProgress(AdoNetContext adoNetContext, ITransactionContext transactionContext, ITransaction transaction); + bool IsInDistributedActiveTransaction(ISessionImplementor session); } } \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1054/DummyTransactionFactory.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1054/DummyTransactionFactory.cs 2009-05-22 18:35:26 UTC (rev 4359) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1054/DummyTransactionFactory.cs 2009-05-22 20:42:29 UTC (rev 4360) @@ -1,30 +1,30 @@ using System; +using System.Collections; using NHibernate.AdoNet; +using NHibernate.Engine; using NHibernate.Transaction; namespace NHibernate.Test.NHSpecificTest.NH1054 { - public class DummyTransactionFactory : NHibernate.Transaction.ITransactionFactory + public class DummyTransactionFactory : ITransactionFactory { - void NHibernate.Transaction.ITransactionFactory.Configure(System.Collections.IDictionary props) + public void Configure(IDictionary props) { - } - ITransaction NHibernate.Transaction.ITransactionFactory.CreateTransaction(NHibernate.Engine.ISessionImplementor session) + public ITransaction CreateTransaction(ISessionImplementor session) { - return null; + throw new NotImplementedException(); } - public ConnectionReleaseMode DefaultReleaseMode + public void EnlistInDistributedTransactionIfNeeded(ISessionImplementor session) { - get { throw new NotImplementedException(); } + throw new NotImplementedException(); } - public bool IsTransactionInProgress(AdoNetContext adoNetContext, ITransactionContext transactionContext, - ITransaction transaction) + public bool IsInDistributedActiveTransaction(ISessionImplementor session) { - throw new NotImplementedException(); + return false; } } } Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1054/NH1054Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1054/NH1054Fixture.cs 2009-05-22 18:35:26 UTC (rev 4359) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1054/NH1054Fixture.cs 2009-05-22 20:42:29 UTC (rev 4360) @@ -22,12 +22,12 @@ } [Test] - public void AdoNetTransactionFactoryIsDefaultTransactionFactory() + public void AdoNetWithDistributedTransactionFactoryIsDefaultTransactionFactory() { Configuration configuration = new Configuration(); ISessionFactoryImplementor sessionFactory = (ISessionFactoryImplementor)configuration.BuildSessionFactory(); - Assert.IsInstanceOfType(typeof(NHibernate.Transaction.AdoNetTransactionFactory), + Assert.IsInstanceOfType(typeof(NHibernate.Transaction.AdoNetWithDistrubtedTransactionFactory), sessionFactory.Settings.TransactionFactory); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |