Question related to managing trasactions with EF Core:
Does an IDbContextTransaction.Rollback() have any chance to return an exception, so that it could ever make sense to place it inside a try block?
i.e.
try
{
//...
if(condition)
transaction.Commit();
else
throw methodReturn.Exception;
}
catch (Exception e)
{
try // Does this try make any sense?
{
transaction.Rollback();
}
catch
{
// Log
}
throw e;
}
PD: In this specific situation it is not possible to embed the transaction into a using statement, so a manual .Rollback() call is required in the real code.