mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 15:33:21 +08:00
Add transaction usage for key binding defaults
This commit is contained in:
parent
29fcd210aa
commit
9aa46bfb0d
@ -36,8 +36,9 @@ namespace osu.Game.Input
|
|||||||
|
|
||||||
private void insertDefaults(IEnumerable<KeyBinding> defaults, int? rulesetId = null, int? variant = null)
|
private void insertDefaults(IEnumerable<KeyBinding> defaults, int? rulesetId = null, int? variant = null)
|
||||||
{
|
{
|
||||||
var context = GetContext();
|
using (var context = GetContext())
|
||||||
|
using (var transaction = context.Database.BeginTransaction())
|
||||||
|
{
|
||||||
// compare counts in database vs defaults
|
// compare counts in database vs defaults
|
||||||
foreach (var group in defaults.GroupBy(k => k.Action))
|
foreach (var group in defaults.GroupBy(k => k.Action))
|
||||||
{
|
{
|
||||||
@ -58,7 +59,8 @@ namespace osu.Game.Input
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
context.SaveChanges();
|
context.SaveChanges(transaction);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user