From 936586b13142d494b732049e8f4eea6def7f6f05 Mon Sep 17 00:00:00 2001 From: cooldavee Date: Wed, 25 Mar 2015 12:58:25 +0100 Subject: [PATCH] fixed "Concurrency-Exception-Handling fails #11" bug --- .../DbContextCollection.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/EntityFramework.Implementation/DbContextCollection.cs b/EntityFramework.Implementation/DbContextCollection.cs index f6570ee..7ccf92f 100644 --- a/EntityFramework.Implementation/DbContextCollection.cs +++ b/EntityFramework.Implementation/DbContextCollection.cs @@ -127,6 +127,7 @@ public int Commit() { tran.Commit(); tran.Dispose(); + _transactions.Remove(dbContext); } } catch (Exception e) @@ -135,11 +136,10 @@ public int Commit() } } - _transactions.Clear(); - _completed = true; - if (lastError != null) lastError.Throw(); // Re-throw while maintaining the exception's original stack track + else + _completed = true; return c; } @@ -179,6 +179,7 @@ public async Task CommitAsync(CancellationToken cancelToken) { tran.Commit(); tran.Dispose(); + _transactions.Remove(dbContext); } } catch (Exception e) @@ -187,11 +188,10 @@ public async Task CommitAsync(CancellationToken cancelToken) } } - _transactions.Clear(); - _completed = true; - if (lastError != null) lastError.Throw(); // Re-throw while maintaining the exception's original stack track + else + _completed = true; return c; }