When used with EntityFrameworkCore, transactions are not rollbacked on Dispose.
In transaction.cs, the Dispose(bool) method is rollbacking the transaction. But as the method is not marked as override, it only hides the Dispose(bool) method from DbTransaction and will only be called if the type of the variable is MysqlTransaction.
DbTransaction dbTransaction = new MysqlTransaction();
dbTransaction.Dispose(true); // calls DbTransaction.Dispose(bool);
MysqlTransaction mysqlTransaction = new MysqlTransaction();
mysqlTransaction.Dispose(true); // calls MysqlTransaction.Dispose(bool);
Therefore, when the RelationalTransaction from EntityFrameworkCore calls the Dispose method on it's _dbTransaction, it won't call the MysqlTransaction.Dispose(bool) method but the one from DbTransaction (that does nothing).
When used with EntityFrameworkCore, transactions are not rollbacked on Dispose.
In transaction.cs, the Dispose(bool) method is rollbacking the transaction. But as the method is not marked as
override
, it only hides the Dispose(bool) method from DbTransaction and will only be called if the type of the variable is MysqlTransaction.Therefore, when the RelationalTransaction from EntityFrameworkCore calls the Dispose method on it's _dbTransaction, it won't call the MysqlTransaction.Dispose(bool) method but the one from DbTransaction (that does nothing).
transaction.cs
Fix: transaction.cs