TransactionScope() in Sql Azure
- by Rick Make
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)
{
}
}
}