SapientGuardian / mysql-connector-net-netstandard

ADO.NET driver for MySQL targeted against netstandard 1.3
GNU General Public License v2.0
46 stars 15 forks source link

Fixed MySqlDataReader not disposed by EntityFrameworkCore #27

Closed how02 closed 8 years ago

how02 commented 8 years ago

EntityFrameworkCore wasn't disposing MySqlDataReader because MySqlDataReader doesn't inherit from DbDataReader. Here is the exception thrown:

Microsoft.EntityFrameworkCore.DbContext:Error: An exception occurred in the database while saving changes. MySql.Data.MySqlClient.MySqlException: There is already an open DataReader associated with this Connection which must be closed first. at MySql.Data.MySqlClient.ExceptionInterceptor.Throw(Exception exception) at MySql.Data.MySqlClient.MySqlCommand.CheckState() at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery() at MySql.Data.MySqlClient.MySqlTransaction.Commit() at Microsoft.EntityFrameworkCore.Storage.RelationalTransaction.Commit() at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.d__1.MoveNext()

This commit fixes the issue.

SapientGuardian commented 8 years ago

Nice catch, thanks for the fix!