Wrapping multiple BO inserts in a Transaction

Wrapping multiple BO inserts in a Transaction

Old forum URL: forums.lhotka.net/forums/t/2963.aspx


petervdm posted on Thursday, May 31, 2007

I have implemented SqlTransaction usage within my business objects, Root object sets up the transaction, stores it in the LocalContext and after inserting/updating itself and its children Removes it from the LocalContext and Commits the transaction.

This works great!

We now have a business requirement to wrap one or more CSLA business objects into a method call and wrap multiple inserts (they are all root objects or different types) in a transaction.


Can I use the LocalContext?  Do I want to setup the connection to the database on the client so that I can create the transaction?

Thanks

Peter

JoeFallon1 replied on Thursday, May 31, 2007

I posted some code on how to do this using LocalContext a while back.

Search for:

BeginTransaction

EndTransaction

RollbackTransaction

CleanupTransaction

William replied on Monday, June 04, 2007

If possible, you can govern your data access operations within TransactionScope.

Regards,
William

Copyright (c) Marimer LLC