-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes committed despite active transaction and rollback in Oracle EF Core #445
Comments
I just realized that this issue is not specific to the OracleException. The transaction was not being used correctly in the first place, so after the first SaveChanges() call, the changes were committed—regardless of whether the later ExecuteNonQuery() call succeeded or threw an exception. Apologies for the oversight. I still wonder if there is a way to make ODP.NET and EF Core share the same transaction though, this is what challenges me. |
On second thought, I'm not sure if this behavior is expected. When calling SaveChanges() and then executing OracleCommand.ExecuteNonQuery(), the changes from SaveChanges() are committed immediately, rather than waiting for CommitTransaction() to be called. Is this the intended behavior? |
Oracle EF Core doesn't currently support DDL statements in transactions. A DDL in a transaction will commit everything up to and including the DDL. If the transaction only had DML, then you would not see the commit occur prematurely. |
Thank you for clarifying @alexkeh ! :) |
EDIT
Read comment
Hello,
I encountered a situation where changes to the database are committed despite an active transaction, even when an error occurs and RollbackTransaction() is called.
The following code demonstrates the issue:
Reproduction Steps
Expected Behavior
Since a transaction was started using context.Database.BeginTransaction(), I expected the context.Headers.Add(header); operation to not be committed because:
However, after inspecting the database, I see that the row was committed.
Reproducible Test Setup
Repro Project linked.
Table Creation
Database User Setup
Environment
ReproOracleCommand.zip
The text was updated successfully, but these errors were encountered: