Fabio,

May I pick your brain regarding the usage of  Session.BeginTransaction() as an 
enlistment into the ambient transaction.

I've seen this question get asked more than a couple of times on the users 
group. So I just want to understand the reasoning for the decision to require 
the management of the NHTransaction & the Ambient transaction 
(TransactionScope). 

I believe the question arises because it is a bit counter intuitive to manage 
both transactions as most other systems that implement System.Transaction, do 
so without the need to manage their older transaction api, or solely support 
the System.Transaction api (The only api I can think of right now is ado.net's 
IDbTransaction, but I remember seeing something around file system)

Thanks,

-Carlos

 

Practice makes perfect, but if no one is perfect, why practice?




Date: Thu, 14 Jan 2010 20:35:56 -0300
Subject: Re: [nhusers] Re: Nested TransactionScope with RequiresNew:    
unexpected behavior
From: [email protected]
To: [email protected]

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].

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.

Reply via email to