mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Centralise BeginTransaction and disable transaction use for now
This commit is contained in:
@ -184,7 +184,7 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
var context = importContext.Value;
|
var context = importContext.Value;
|
||||||
|
|
||||||
using (var transaction = context.Database.BeginTransaction())
|
using (var transaction = context.BeginTransaction())
|
||||||
{
|
{
|
||||||
// create local stores so we can isolate and thread safely, and share a context/transaction.
|
// create local stores so we can isolate and thread safely, and share a context/transaction.
|
||||||
var iFiles = new FileStore(() => context, storage);
|
var iFiles = new FileStore(() => context, storage);
|
||||||
@ -295,7 +295,7 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
var context = importContext.Value;
|
var context = importContext.Value;
|
||||||
|
|
||||||
using (var transaction = context.Database.BeginTransaction())
|
using (var transaction = context.BeginTransaction())
|
||||||
{
|
{
|
||||||
context.ChangeTracker.AutoDetectChangesEnabled = false;
|
context.ChangeTracker.AutoDetectChangesEnabled = false;
|
||||||
|
|
||||||
|
@ -92,6 +92,12 @@ namespace osu.Game.Database
|
|||||||
modelBuilder.Entity<BeatmapInfo>().HasOne(b => b.BaseDifficulty);
|
modelBuilder.Entity<BeatmapInfo>().HasOne(b => b.BaseDifficulty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IDbContextTransaction BeginTransaction()
|
||||||
|
{
|
||||||
|
// return Database.BeginTransaction();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public new int SaveChanges(IDbContextTransaction transaction = null)
|
public new int SaveChanges(IDbContextTransaction transaction = null)
|
||||||
{
|
{
|
||||||
var ret = base.SaveChanges();
|
var ret = base.SaveChanges();
|
||||||
|
@ -39,7 +39,7 @@ 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)
|
||||||
{
|
{
|
||||||
using (var context = GetContext())
|
using (var context = GetContext())
|
||||||
using (var transaction = context.Database.BeginTransaction())
|
using (var transaction = context.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))
|
||||||
|
Reference in New Issue
Block a user