Thursday, May 1, 2014

What is the recovery path for TransactionInDoubtException ?

Can somebody tell me what is the proper way to handle TransactionInDoubtException


and roll back partial commits?



var option = new TransactionOptions();
option.IsolationLevel = IsolationLevel.ReadCommitted
using (var scope = new TransactionScope(TransactionScopeOption.Required, option))
{
try
{
Context.SaveEmail(_emailInfoList);
context.SaveSyncState(syncState);
scope.Complete();
return true;
}
catch (TransactionInDoubtException ex)
{
// Looks like commit has already taken place
// How to roll back the changes ??
// sth like scope.Rollback()
}
}





No comments:

Post a Comment