You are closing the session in some other place. You will easy found it if you will try to recreate the situation in a pure-NH-100% test without all your wrappers (_sessionManager, _repository).
On Wed, Sep 1, 2010 at 2:22 PM, Amzath <[email protected]> wrote: > As handler does not use MSDTC, I have removed transaction scope from > the code. Now code looks like this but getting same exception. Please > help me on this I have this issue in for last 10 days and could not > figure out why. > > (var session = _sessionManager.OpenSession(DatabaseAli)) > { > using (var tran = > session.BeginTransaction()) > { > var Customer = > _repository.Get(new > CustomerByCustomerId(CustomerUpdate.CustomerIdentifier)); > > UpdateCustomerInfo(Customer, CustomerUpdate); > > UpdateCustomerAccountLimit(Customer, CustomerUpdate); > > UpdateCustomerMethods(Customer, CustomerUpdate); > > _repository.Store(Customer); > > tran.Commit(); > } > } > > > On Sep 1, 9:43 am, Amzath <[email protected]> wrote: > > That did not help. Any other way to figure out why is that occuring? > > > > On Aug 31, 5:09 pm, Fabio Maulo <[email protected]> wrote: > > > > > > > > > Put tx.Complete() in the 'using' of the TxScope not in the 'using' of > the > > > session. > > > > > On Tue, Aug 31, 2010 at 7:36 PM, Amzath <[email protected]> > wrote: > > > > Getting an error when commiting the transaction. I am opening and > > > > closing the session properly. But I dont know why this error occurs? > > > > Can any one helps me? > > > > > > Code: > > > > > > using (var tx = new > > > > TransactionScope(TransactionScopeOption.Suppress)) > > > > using (var session = > > > > _sessionManager.OpenSession(DatabaseAli)) > > > > { > > > > using (var tran = > > > > session.BeginTransaction()) > > > > { > > > > > > var Customer = > > > > _repository.Get(new > > > > CustomerByCustomerId(CustomerUpdate.CustomerIdentifier)); > > > > > > UpdateCustomerInfo(Customer, CustomerUpdate); > > > > > > UpdateCustomerAccountLimit(Customer, CustomerUpdate); > > > > > > UpdateCustomerMethods(Customer, CustomerUpdate); > > > > > > _repository.Store(Customer); > > > > > > tran.Commit(); > > > > } > > > > tx.Complete(); > > > > } > > > > > > Error: > > > > > > 2010-08-31 16:01:41,687 [Worker.5] ERROR > > > > MyTest.ConsumerApp.Services.Handlers.CustomerUpdater [(null)] - End: > > > > HandlingMessage: Failed handling CustomerUpdate message from > > > > System.ObjectDisposedException: Cannot access a disposed object. > > > > Object name: 'AdoTransaction'. > > > > at NHibernate.Transaction.AdoTransaction.CheckNotDisposed() > > > > at NHibernate.Transaction.AdoTransaction.Commit() > > > > at > > > > > MyTest.ConsumerApp.Services.Handlers.CustomerUpdater.Handle(CustomerUpdate > > > > CustomerUpdate) in C:\MyTest\trunk\ConsumerApp\Services\Handlers > > > > \CustomerUpdater.cs:line 113 > > > > > > -- > > > > You received this message because you are subscribed to the Google > Groups > > > > "nhusers" group. > > > > To post to this group, send email to [email protected]. > > > > To unsubscribe from this group, send email to > > > > [email protected]<nhusers%[email protected]> > <nhusers%[email protected]<nhusers%[email protected]> > > > > > > . > > > > For more options, visit this group at > > > >http://groups.google.com/group/nhusers?hl=en. > > > > > -- > > > Fabio Maulo- Hide quoted text - > > > > > - Show quoted text -- Hide quoted text - > > > > - Show quoted text - > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- Fabio Maulo -- You received this message because you are subscribed to the Google Groups "nhusers" 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/nhusers?hl=en.
