Skip to content

Commit 7af9779

Browse files
authored
Merge pull request #1254 from dmytro-gokun/2019-05-06-fix-rainbow-database-dispose
2 parents dffb443 + 1f8e09e commit 7af9779

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Dapper.Rainbow/Database.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,12 +473,12 @@ public SqlMapper.GridReader QueryMultiple(string sql, dynamic param = null, IDbT
473473
/// </summary>
474474
public virtual void Dispose()
475475
{
476-
if (_connection.State != ConnectionState.Closed)
476+
var connection = _connection;
477+
if (connection.State != ConnectionState.Closed)
477478
{
478-
_transaction?.Rollback();
479-
480-
_connection.Close();
481479
_connection = null;
480+
_transaction = null;
481+
connection?.Close();
482482
}
483483
GC.SuppressFinalize(this);
484484
}

0 commit comments

Comments
 (0)