Hey
I'm using using transactions in my code but it's not working when Rolling Back. Here is an example:
try
{
TransactionManager trans = DataRepository.Provider.CreateTransaction();
trans.BeginTransaction();
try
{
// Update Entity1
// Update Entity2
// If I throw an exception here it should roolback the updates on Entity1 and Entity2 but it doesn't
throw new Exception("any exception");
// Update Entity3
trans.Commit();
}
catch (Exception ex)
{
trans.Rollback();
throw new Exception(ex.Message);
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
Does anyone know how to solve this?