For those reasons the ITransaction shouldn't be a merely
"ADO.NETtransaction wrapper" (or so near to
it).session.BeginTransaction
should know which is the environment, it should know if it should run in a
nested DTC transaction ... and so on.
The user only need to know that i must call session.BeginTransaction, NH
should to the right thing.

2009/3/23 Michael Teper <[email protected]>

>  Fabio, Ayende,
>
> Another thing to consider is the nested transaction scenario like this:
>
> using (var scopeOuter = new TransactionScope())
> {
>    // load / change some object(s)
>
>    using (var innerScope = new TransactionScope())
>    {
>        try
>        {
>            // load / change something else
>            innerScope.complete();
>        }
>        catch { // do something }
>     }
>
>     outerScope.complete();
> }
>
> This may look silly but if the inner transaction is encapsulated in a
> different class, this is a very plausible scenario. Wherever NH keeps track
> of the current transaction scope, it needs to be aware of potential for
> nesting.
>
> Thanks!
> -Michael
>
>
>  ------------------------------
> *From:* [email protected] [
> [email protected]] On Behalf Of Fabio Maulo [
> [email protected]]
> *Sent:* Monday, March 23, 2009 9:45 AM
> *To:* [email protected]
> *Subject:* [nhibernate-development] Re: More DTC issues
>
>
>
> 2009/3/23 Ayende Rahien <[email protected]>
>
>> The problem is that usually the DTC is opened by a lower level component,
>> and my code has no control over it. More than that, I usually don't have
>> control over NH's code as well.
>>
>>  It goes like this:
>>
>>  1/ low level infrastructure - dtc
>> 2/ high level infarstruture - nh
>> 3/ business code - my stuff
>>
>
>  and then
> 3 -end
> 2- end
> 1-end
>
>  If 2 don't know about 1, 2 should use session.BeginTransaction and
> session.Transaction.Commit().
>
>
>>
>>  I don't want to be aware of all of this issues, I just want to make this
>> work.
>> So explicitly flushing is an option that I would generally be against.
>>
>>  Making NH's transaction equal to the dtc is also not a good option,
>> because the use of the DTC is to manage several resources, not just NH.
>>
>
>  You know... I never said dtc=nhTx
> What I would like to avoid is If(DTC) {something} else {somethingelse}
> inside NH-Core.
>
>  --
> Fabio Maulo
>



-- 
Fabio Maulo

Reply via email to