Nested transaction

Posts   
 
    
Anderskj1
User
Posts: 33
Joined: 11-Jan-2005
# Posted on: 18-Feb-2005 13:30:37   

Hi

Is it possible to do something like this.

public method(Transaction outer, id) { try{ Transaction inner = new Transaction(IsoLev.ReadCom, "the name");

// Now somehow make outer fail if inner fails. // Can i somehow add tje inner trasnation to the outer?

// do local stuff with id
inner.comit();

}catch(Exp e) { inner.RolBack(); }

}

I have some rather generic business methods which I sometime want to call with an outer transaction.

More specific.

When I call method whith outer = null the method should only use the inner transaction. IF an outer transaction is supplied they both should be depended of each outer so if inner transaction fails the outer should fail as well

Is this possible?

Thanks

wayne avatar
wayne
User
Posts: 611
Joined: 07-Apr-2004
# Posted on: 18-Feb-2005 13:57:57   

As far as i know - ADO.Net only supports 1 transaction per connection object - thus LLBLGen will have the same limitation.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 18-Feb-2005 13:59:11   

Why don't you do:

public void Method(Transaction outer, id) { ITransaction toUse = outer; if(toUse==null) { // create new one toUse = new Transaction(...); }

and all code in Method uses toUse from then on.

Frans Bouma | Lead developer LLBLGen Pro
Anderskj1
User
Posts: 33
Joined: 11-Jan-2005
# Posted on: 18-Feb-2005 14:12:02   

Otis wrote:

Why don't you do:

public void Method(Transaction outer, id) { ITransaction toUse = outer; if(toUse==null) { // create new one toUse = new Transaction(...); }

and all code in Method uses toUse from then on.

sunglasses . I have absolutley no idea why not ! So simple.

Thanks alot.

Anders