1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 22:07:25 +08:00

Add proper transaction rollback logic on exception

This commit is contained in:
Dean Herbert 2018-05-28 18:38:42 +09:00
parent f6f18e2fe2
commit 2a87b851fa

View File

@ -28,8 +28,19 @@ namespace osu.Game.Database
if (isDisposed) return;
isDisposed = true;
PerformedWrite |= Context.SaveChanges(transaction) > 0;
usageCompleted?.Invoke(this);
try
{
PerformedWrite |= Context.SaveChanges(transaction) > 0;
}
catch (Exception e)
{
transaction?.Rollback();
throw;
}
finally
{
usageCompleted?.Invoke(this);
}
}
public void Dispose()