mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 13:37:25 +08:00
Add proper transaction rollback logic on exception
This commit is contained in:
parent
f6f18e2fe2
commit
2a87b851fa
@ -28,9 +28,20 @@ namespace osu.Game.Database
|
||||
if (isDisposed) return;
|
||||
isDisposed = true;
|
||||
|
||||
try
|
||||
{
|
||||
PerformedWrite |= Context.SaveChanges(transaction) > 0;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
transaction?.Rollback();
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
usageCompleted?.Invoke(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user