Hi folks, I am doing several operations inside a Transaction Scope, when a failure occurs then it is redirected to the Rollback but the pre-failure saves are committed to db.
if (!_session.IsOpen) _session.SessionFactory.OpenSession();
using (_session.BeginTransaction())
{
try
{
Remittance remittance = new Remittance();
...
_remittanceDao.SaveOrUpdate(remittance);
TripSent tripSent = new TripSent();
try
{
TripSent tripSent = CreatTripSent();
_tripSentDao.Save(tripSent);
}
catch (Exception ex)
{
throw new Exception(String.Format("Erro criando TripSent com índice {0}", i), ex);
}
Entity.TransactionFile eTransactionFile = new Entity.TransactionFile();
...
_transactionFileDao.SaveOrUpdate(eTransactionFile);
_session.Transaction.Commit();
processOk = true;
}
catch
{
_session.Transaction.Rollback();
throw;
}
}
The error is occuring in the line _tripSentDao.Save(tripSent); and, even after the Rollback I check the DB and the _remittanceDao.SaveOrUpdate(remittance); is there.