I have a function setup in my Bus Logic Layer similar to the following
function ProcessOrders
function InsertOrder
function InsertOrderItems
I need to be make sure all functions use the same Transaction (Enterprise
Lib DbTransaction object) between method calls.
How shoudl I lat this out?
Cheers
S
Example: add a reference to System.Transactions, then
// cheesy example ;-p
static void Transfer(int fromAccount, int toAccount, int amount)
{
using (TransactionScope tran = new TransactionScope())
{
Debit(fromAccount, amount);
Credit(toAccount, amount);
tran.Complete();
}
}
On SQL2000, it uses DTC from the outset (since SQL2000 transactions
aren't promoteable) - but on SQL2005 it uses the "LTM" (lightweight
transaction manager) to start with a SQL transaction, and promote that
to a DTC transaction if necessary (for instance you start talking to a
second server...).
Marc
"Marc Gravell" <marc.g...@gmail.com> wrote in message
news:5aa8fd1e-a364-480e...@a23g2000hsc.googlegroups.com...
Alternatively, just use your favorite search engine...
Marc