Transaction Scope and multithread
Posted: Mon 09 Mar 2009 09:34
Hello,
I have a WCF service and I have a problem with TransactionScope when connection is not in direct mode (Direct=False).
I have something like this:
when there are multiple concurrent threads it works only in direct=true connection mode, in direct=false connection mode all the transactions fail. It seems that in direct=false connection mode transactions are merged in some way even if TransactionScopeOption.RequiresNew flag.
Thanks for your support.
I have a WCF service and I have a problem with TransactionScope when connection is not in direct mode (Direct=False).
I have something like this:
Code: Select all
TransactionOptions transactionOptions = new TransactionOptions();
transactionOptions.IsolationLevel = IsolationLevel.ReadCommitted;
transactionOptions.Timeout = new TimeSpan(0, 0, 30);
using (TransactionScope transactionScope = new TransactionScope(TransactionScopeOption.RequiresNew, transactionOptions))
{
using (SomeObjectContext someObjectContext = new SomeObjectContext())
{
...
someObjectContext.SaveChanges();
}
transactionScope.Complete();
}
Thanks for your support.