I think I've isolated the problem to NHibernate. I posted about the issue on the nhusers list. Hopefully that will get me somewhere. Is anyone else using the NH trunk with RSB? What do your MessageModules look like?
On Mon, Aug 3, 2009 at 8:46 AM, tyler.burd <[email protected]> wrote: > Hi again. I'm trying to use NHibernate, ActiveRecord, and Rhino's > UnitOfWork together with RSB (everything from the trunks). I am using > a MessageModule to initiate a UnitOfWork (listed at the end of the > message). I have a simple message handler that simply loads an entity > via IRepository, changes a few properties, and then throws an > exception to force a rollback. Extremely simple test case, but I keep > getting this exception when a message is handled: > Completed transaction was disposed, assuming transaction rollback > System.ObjectDisposedException: Cannot access a disposed object. > Object name: 'Transaction'. > at System.Transactions.Transaction.get_TransactionInformation() > at > > NHibernate.Transaction.AdoNetWithDistrubtedTransactionFactory.<>c__DisplayClass1.<EnlistInDistributedTransactionIfNeeded>b__0 > (Object sender, TransactionEventArgs e) in d:\oss\2009-07-27\nhibernate > \src\NHibernate\Transaction > \AdoNetWithDistrubtedTransactionFactory.cs:line 42 > > This occurs when I use SQL Server 2005 as the db. When I use > postgresql I get an "InvalidOperationException" in NHibernate saying > that I cannot call disconnect when a transaction is in process, and > then the whole process crashes. > > Here is my MessageModule. Is there something different I should be > doing? Is anyone else using NH, AR, and Rhino with RSB? > > public class UnitOfWorkMessageModule : IMessageModule > { > public void Init(ITransport transport) > { > transport.MessageArrived += transport_MessageArrived; > transport.MessageProcessingCompleted += > transport_MessageProcessingCompleted; > } > > void transport_MessageProcessingCompleted > (Rhino.ServiceBus.Impl.CurrentMessageInformation arg1, Exception arg2) > { > if (UnitOfWork.IsStarted) > UnitOfWork.Current.Dispose(); > } > > bool transport_MessageArrived > (Rhino.ServiceBus.Impl.CurrentMessageInformation arg) > { > UnitOfWork.Start(); > return false; > } > > public void Stop(ITransport transport) > { > transport.MessageArrived -= transport_MessageArrived; > transport.MessageProcessingCompleted -= > transport_MessageProcessingCompleted; > } > } > > Thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Rhino Tools Dev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rhino-tools-dev?hl=en -~----------~----~----~----~------~----~------~--~---
