TransactionScope() in Sql Azure
Posted
by Rick Make
on Stack Overflow
See other posts from Stack Overflow
or by Rick Make
Published on 2010-04-09T03:29:55Z
Indexed on
2010/04/09
3:33 UTC
Read the original article
Hit count: 678
Does Sql Azure support using TransactionScope() when performing inserts? Below is a code snippet of what I am trying to do.
using (var tx = new TransactionScope(TransactionScopeOption.RequiresNew, new TransactionOptions() { IsolationLevel = IsolationLevel.ReadCommitted }))
{
using (var db = MyDataContext.GetDataContext())
{
try
{
MyObject myObject = new MyObject()
{
SomeString = "Monday"
};
db.MyObjects.InsertOnSubmit(myObject);
db.SubmitChanges();
tx.Complete();
}
catch (Exception e)
{
}
}
}
© Stack Overflow or respective owner