I have run into errors with TransactionScope and Session/Transaction handling. what I have seen occur is the transaction is started on one thread, but attempts to close on another and NH didn't like this. Instead of TS I manage both NH factories/sessions/transactions either both transactions commit or rollback.
On Jan 14, 6:35 pm, Fabio Maulo <[email protected]> wrote: > you can commit the NH's transaction and leave the real action to TS > (Abort/Complete). > Why ?... > Well... you should manage the NH's always and occasionally the NH's will > work in an Ambient-Transaction. > The code where the NH's transaction is managed shouldn't not be aware about > if it is working in Ambient-Transaction or not. > For those using AOP this is pretty normal. > > btw, have you tried using the NH's transaction in your tests ? > > 2010/1/14 HH <[email protected]> > > > > > So you are suggesting that I should use the following: > > > OnActionExecuting: > > 1) Open Session (if not open) > > 2) CreateTransactionScope > > 3) Start NHibernate Transaction > > > OnActionExecuted: > > if ([errorsOccured]) > > Rollback NHibernate transaction > > else > > Commit NHiberate transaction > > TransactionScope.Complete() > > > Session will be closed on end request. > > > This makes me have to manage both the TransactionScope and NHibernate > > transaction. > > > Why? > > > Henk > > > On 14 jan, 22:49, Fabio Maulo <[email protected]> wrote: > > > 2010/1/14 HH <[email protected]> > > > > > Do you have any ideas on how to make this work? > > > > with an appropriate ActionFilter to manage NH's session, TS and NH's > > > transaction > > > > 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]<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.
