Java Mailing List Archive

http://www.gg3721.com/

Home » the NHibernate development list »

[NHibernate-development] Ado.Net2.0 Transactions on NHibernate

Dario Quintana

2008-03-06

Replies: Find Java Web Hosting

Author LoginPost Reply
Hi all...

Just to notify what I'm doing now. I'm studing and reading the posibility of change/improve our transaction support (was wrote at .net1.1 time)
Our transaction support is *explicit*, it mean we are using for example IDbTransaction to delimit transaction "scope". My idea is use th *implicit* support proposed by Ado.Net2.0: System.Transactions.

For ilustrate my draw idea, I wrote this tentative code:

    using(ITransaction tx1 = s.BeginTransaction())
    {   
        using(ITransaction tx2 s.BeginTransaction())
        {
            //Transactional work here
            tx2.Commit();
        }
        //Transactional work here
        tx1.Commit();
    }


This mean that tx2 will be enlisted onto tx1, and tx1 depends of the success of tx2. Equivalent to this TransactionScope example:

using(TransactionScope tx1 = new TransactionScope())
{     
       using(TransactionScope tx2 = new TransactionScope(Required))
       {
            //Transactional work here
            tx2.Complete();
       }
        //Transactional work here
        tx1.Complete();
}

Other escenario could be this:

    using(ITransaction tx1 = s.BeginTransaction())
    {   
        using(ITransaction tx2 s.BeginTransaction(Scope.RequiresNew))
        {
            //Transactional work here
            tx2.Commit();
        }
        //Transactional work here
        tx1.Commit();
    }

This mean that the inner transaction (tx2) requires another transaction for it work (maybe for business-logging at domain level), and it success/failed doesn't it matter to tx1.

Some considerations:
- The main idea is support the modes: Required, RequiresNew, Suppress[?].
- Deprecate our tx-support, or just join with it? If we support both, it mean support: IDbTransaction and System.Transactions, could be painful to implement and maintain and I think that we could just use System.Transactions without performance lost.
- To much easy to jump at DTC support (it come for free).

I need feedback, ideas, comments, advantajes, disadvantages, anything that you could say.

This is a good start for know System.Transactions: http://msdn2.microsoft.com/en-us/library/ms973865.aspx

Best regards.
--
Dario Quintana
http://darioquintana.com.ar
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development@(protected)
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
©2008 gg3721.com - Jax Systems, LLC, U.S.A.