-
Notifications
You must be signed in to change notification settings - Fork 337
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
Exception InvalidOperationException with dapper and transaction #452
Comments
MySqlConnector currently requires the active transaction to be specified (to catch programming errors); this is a known breaking change from Oracle's Connector/NET. To do this with Dapper, write:
See this comment for the full explanation: #405 (comment) |
Ok thanks. It is work fine with transaction parameter. |
For future reference, you can also opt in to the Connector/NET behaviour by adding |
Is there a difference in performance? |
No, there is no difference in performance when setting that option. |
Hi,
I try to execute a insert with dapper in a transaction:
On execute, i have this exception:
System.InvalidOperationException
HResult=0x80131509
Message=The transaction associated with this command is not the connection's active transaction.
Source=System.Private.CoreLib
StackTrace:
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery() in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlCommand.cs:line 60
at Dapper.SqlMapper.ExecuteCommand(IDbConnection cnn, CommandDefinition& command, Action
2 paramReader) in C:\projects\dapper\Dapper\SqlMapper.cs:line 2827 at Dapper.SqlMapper.ExecuteImpl(IDbConnection cnn, CommandDefinition& command) in C:\projects\dapper\Dapper\SqlMapper.cs:line 570 at Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable
1 commandTimeout, Nullable`1 commandType) in C:\projects\dapper\Dapper\SqlMapper.cs:line 443Follow the test project:
TestMysqlconnector.zip
I use:
This code work fine with mysql connector of Oracle.
Regards
The text was updated successfully, but these errors were encountered: