Skip to content
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

MySqlCommand.IsValid() does not allow the Transaction to default to Connection.CurrentTransaction #457

Closed
billlx opened this issue Mar 15, 2018 · 3 comments

Comments

@billlx
Copy link

billlx commented Mar 15, 2018

As currently implemented, MySqlCommand.IsValid(out Exception exception) does not check for a null value before requiring its Transaction instance to match Connection.CurrentTransaction. This behavior diverges from MySQL.Data, which does accept such commands. The workaround is not difficult (explicitly assign the MySQLCommand.Transaction property before issuing it), but it would seem worth following the MySQL.Data behavior for interoperability reasons.

@bgrainger
Copy link
Member

The current (strict) behavior was a deliberate choice (see #405 (comment)) but may need to be changed for compatibility (e.g., see #452).

@billlx
Copy link
Author

billlx commented Mar 15, 2018

Sorry, I hadn't noticed this earlier issue.

@bgrainger
Copy link
Member

In MySqlConnector 0.39.0, you can opt in to the Connector/NET behaviour by adding IgnoreCommandTransaction=true to your connection string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants