Code: Select all
[TestMethod]
public void TestUpdate()
{
for (int i = 0; i < 1000; i++)
{
using (TransactionScope tx = new TransactionScope())
{
DependentTransaction depTx = Transaction.Current.DependentClone(DependentCloneOption.BlockCommitUntilComplete);
System.Threading.Tasks.Task.Factory.StartNew(() =>
{
Thread.Sleep(100);
depTx.Complete();
});
//var connection = CreateConnection(); //pseudo code
// connection.Update("UPDATE test SET value='bar' WHERE key='foo'"); //pseudo code
tx.Complete();
}
}
}