Saving 2 diff entities recursively in 1 trans.

Posts   
 
    
netLearner
User
Posts: 150
Joined: 18-Oct-2003
# Posted on: 08-Mar-2005 22:20:35   

Just wondering if this is supported in Pro: I have 2 diff entities Ent1 and Ent2. Some changes are made in the hierarchy of these 2 objects, is it possible to save them both recursively in 1 transaction? I know we can do: Ent1.Save(true); Ent2.Save(true); But this will result in 2 trans. I am wondering if it is possible to do it in 1 trans. Thanks.

Cadmium avatar
Cadmium
User
Posts: 153
Joined: 19-Sep-2003
# Posted on: 09-Mar-2005 00:29:46   

You can do this with the adapter model:


DataAccessAdapter adapter = new DataAccessAdapter();
adapter.StartTransaction( IsolationLevel.ReadCommitted, "TransactionName");
adapter.SaveEntity( ent1, false, null, true );
adapter.SaveEntity( ent2, false, null, true );
adapter.Commit();


Should happen in one connection and one transaction. That should be correct, I'm sure Frans will say if it's not wink

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 09-Mar-2005 09:16:20   

Cadmium has the correct answer! simple_smile

Frans Bouma | Lead developer LLBLGen Pro
swallace
User
Posts: 648
Joined: 18-Aug-2003
# Posted on: 09-Mar-2005 15:45:30   

Otis wrote:

Cadmium has the correct answer! simple_smile

You should build a points system into TinyForum for when others get the right answer! simple_smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 09-Mar-2005 20:46:36   

swallace wrote:

Otis wrote:

Cadmium has the correct answer! simple_smile

You should build a points system into TinyForum for when others get the right answer! simple_smile

To win great prices I pressume wink

Frans Bouma | Lead developer LLBLGen Pro
Cadmium avatar
Cadmium
User
Posts: 153
Joined: 19-Sep-2003
# Posted on: 09-Mar-2005 21:40:31   

Otis wrote:

swallace wrote:

Otis wrote:

Cadmium has the correct answer! simple_smile

You should build a points system into TinyForum for when others get the right answer! simple_smile

To win great prices I pressume wink

Yay! What did I win? wink

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 10-Mar-2005 12:00:34   

Cadmium wrote:

Otis wrote:

swallace wrote:

Otis wrote:

Cadmium has the correct answer! simple_smile

You should build a points system into TinyForum for when others get the right answer! simple_smile

To win great prices I pressume wink

Yay! What did I win? wink

A large pack of brand new, shining self-esteem 2000(tm). How about that? smile

Frans Bouma | Lead developer LLBLGen Pro
Cadmium avatar
Cadmium
User
Posts: 153
Joined: 19-Sep-2003
# Posted on: 10-Mar-2005 23:59:21   

Otis wrote:

A large pack of brand new, shining self-esteem 2000(tm). How about that? smile

I was hoping for an upgrade to self-esteem XP, but I'll take what I can get sunglasses