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

CreateCommand sets Transaction property #389

bgrainger opened this issue Nov 3, 2017 · 1 comment

CreateCommand sets Transaction property #389

bgrainger opened this issue Nov 3, 2017 · 1 comment


Copy link

@bgrainger bgrainger commented Nov 3, 2017

Consider the following code:

using (var connection = new XConnection(...))
    using (var transaction = connection.BeginTransaction())
    using (var cmd = connection.CreateCommand()
        Console.WriteLine(cmd.Transaction == null);

Connector/NET, SqlConnection and NpgsqlConnection all print true; MySqlConnector prints false because .Transaction is set to the active transaction. We should follow the pattern of other ADO.NET connectors and require .Transaction to be set explicitly.

It's possible this could be affecting #333 if commands are being created with an active transaction, then used again after that transaction is committed.

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

No branches or pull requests

1 participant