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

Support System.Transactions. #241

Merged
merged 2 commits into from
Apr 15, 2017
Merged

Conversation

bgrainger
Copy link
Member

Adds support for ambient transactions, and for explicitly enlisting with EnlistTransaction.

Unlike Connector/NET, this is implemented using MySQL's XA Transactions. This may be a compatibility problem for users migrating from Connector/NET, but better matches the purpose/intent of TransactionScope.

Currently only implemented for .NET Framework 4.5.1, since .NET Core won't support System.Transactions until netstandard-2.0: dotnet/corefx#10089

Copy link
Contributor

@caleblloyd caleblloyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice addition to MySqlConnector!

@bgrainger
Copy link
Member Author

I'm going to implement the AutoEnlist connection string setting before merging this. Because this implementation uses XA Transactions it's subject to these restrictions and clients can't use these statements during one. Supporting AutoEnlist will let clients opt into Connector/NET compatible behaviour as follows:

Old:

using (var ts = new TransactionScope())
using (var conn = new MySqlConnection(connStr))
{
    conn.Open();
    // ...
    ts.Complete();
}

Compatible:

using (var ts = new TransactionScope())
using (var conn = new MySqlConnection(connStr + ";AutoEnlist=False"))
{
    conn.Open();
    using (var mySqlTrans = conn.BeginTransaction())
    {
        // ...
        mySqlTrans.Commit();
        ts.Complete();
    }
}

@bgrainger bgrainger merged commit 09d48fa into mysql-net:master Apr 15, 2017
@bgrainger bgrainger deleted the transactions branch April 15, 2017 20:43
@bgrainger
Copy link
Member Author

Implemented in 0.18.0.

lauxjpn added a commit to lauxjpn/Pomelo.EntityFrameworkCore.MySql that referenced this pull request Sep 16, 2019
lauxjpn added a commit to lauxjpn/Pomelo.EntityFrameworkCore.MySql that referenced this pull request Sep 16, 2019
…y MySqlConnector (see mysql-net/MySqlConnector#241 ).

Add TestMySqlRetryingExecutionStrategy for consistency with other providers, though it is not beeing used at the moment.
Fixes PomeloFoundation#612
lauxjpn added a commit to PomeloFoundation/Pomelo.EntityFrameworkCore.MySql that referenced this pull request Sep 20, 2019
* General adjustments for 2.2.6.

* Support test runners with different base directories (e.g. in case of shadow copying).

* Improve CommandTimeout support. Some queries might run longer than the previous default setting of 30 seconds. Use 600 seconds (SQL Server provider default) instead. This will also be applied to queries setting up the database test environment.

* Improve support for CAST(). Use either SQL or DbDataProvider workarounds for unsupported casts.

* Fix support for String.Contains(), which is case sensitive by default.

* Client evaluate arithmetic DateTime operations (as expected by tests).

* Upgrade test infrastructure to 2.2.6.
Fix many issues responsible for previously failed tests.
Reactivate previously skipped tests, that work fine now.

* PackageReference must use an MSBuild variable to set the version.

* Consolidate Convert.ToInt32 translation to CONVERT() (and similar methods calls), with improved CAST() support.

* Update version to 2.2.6-wip.

* Apply debugging references.

* Updated nuget packages & fix formatting rules

* Updated TargetFramework and move to .NET Core 3.0

* First commit towards .NET Core 3

* Update MySqlSqlTranslatingExpressionVisitor and MySqlSqlTranslatingExpressionVisitorFactory to 3.0.

* Update MySqlConverterCommandBuilderFactory to 3.0.

* Update MySqlStringMethodTranslator to 3.0.
Remove obsolete classes.

* Update MySqlQuerySqlGenerator to 3.0.
Disable VisitSqlParameter NO_BACKSLASH_ESCAPES for the moment and update later, if necessary.

* Rename MySqlConnection back to MySqlRelationalConnection (+ interface).
Update MySqlRelationalConnection to 3.0.

* Update extensions to 3.0 (still need to be evaluated).

* Update package references.
Versions need to be refactored into build variables before PR.

* Update debugging references and paths.

* Update MySqlConvertTranslator to 3.0.

* Update existing tests to 3.0.

* Update expressions to 3.0.

* Remove files/features that have not been implemented, are obsolete or have been moved.

* Update MySqlConvertTranslator to 3.0.

* Upgrade MySqlRegexIsMatchTranslator to 3.0.

* Fix and update MySqlStringComparisonTranslator to 3.9.

* Fix MySqlDateTimeMemberTranslator.
Implement DateTime.Millisecond support.

* Fix MySqlObjectToStringTranslator.

* Update MySqlDateTimeMethodTranslator to 3.0.

* Fix extend and consolidate MySqlStringMethodTranslator.

* Temporarily disable NO_BACKSLASH_ESCAPES support.

* Upgrade string concatination support to 3.0.

* Upgrade CAST() support to 3.0.

* Fix infrastructure issues.

* Update Northwind to 3.0.

* Refactor MySql specific test cases into partial class.
Start test update to 3.0.

* Revert arithmetic handling auf date types back to 2.2.6 and update to 3.0.

* Adjust file locations and namespaces.

* Explicitly state the set operations EXCEPT and INTERSECT as unsupported and trigger client eval (if enabled).

* Fix DateTime.DayOfYear translation.

* Update tests for unsupported features to check for the expected exception.

* Implement MySQL's DIV (integer division) operator.
Fix DateTime.Milliseconds translation and test.

* Revert MySqlValueGenerationConvention to original.

* Remove SQL Server specific validator implementations.

* Fix RowVersion TypeMapping.

* Fix bug due to unexpectedly changed behavior of InExpression.Print() in 3.0.
See dotnet/efcore#17860

* Update LoggingMySqlTest to 3.0.

* Fix Trim behavior.

* Ambient transaction are supported by EF Core 2.1+ and are supported by MySqlConnector (see mysql-net/MySqlConnector#241 ).
Add TestMySqlRetryingExecutionStrategy for consistency with other providers, though it is not beeing used at the moment.
Fixes #612

* Misc small changes.

* Update string comparison baselines.

* Update string length handling and baseline.

* Update String.IndexOf and multiple baselines.

* Fix Enumerable.LongCount() handling.

* Fix niladic functions by providing an empty arguments array to force (empty) parenthesis after the function name.

* Fix primary key issue. MySQL InnoDB has the requirement, that an AUTO_INCREMENT column has to be the first column participating in an index.

* Update EFCore.MySql.Tests to 3.0.

* Update dependencies and remove local debugging settings.

* Update version.

* Update dependencies for CI execution.

* Provide a better development/debugging experience for the default project files, by introducing the $(LocalEFCoreRepository) property (see development.props.sample), to compile against a local version of EFCore.

* Update upstream files.

* Implement SupportedServerVersionTheory to skip tests, that are not supported by the database server version used at the time.

* Support DateTimeOffset.Now, DateTimeOffset.UtcNow and DateTimeOffset.Today.

* Support additional math functions.

* Update datetime baselines.

* Support CrossApply and OuterApply using LATERAL (MySQL >= 8.0.14).

* Support shorter column rename syntax without column type definition as of MySQL 8.0.0.

* Add support to run tests, if the currently used database server version is lower than the one specified.

* Trigger client eval, if CrossApply or OuterApply is not supported by the database server.

* Improve SupportedServerVersion attributes to not overwrite existing Skip messages.

* Remove obsolete Translator.

* Activate tests that are working now. Skip tests due to bugs in MySQL implementations.

* Update CI config for 3.0.

* Deactivate KoreBuild (it's obsolete and not compatible with .NET Core 3.0). Skip test for now to merge as WIP.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants