mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 15:16:38 +09:00
Add back transaction support for beatmap importing
This commit is contained in:
@ -10,12 +10,15 @@ namespace osu.Game.Database
|
||||
public abstract class DatabaseBackedStore
|
||||
{
|
||||
protected readonly Storage Storage;
|
||||
protected readonly OsuDbContext Context;
|
||||
|
||||
protected DatabaseBackedStore(OsuDbContext context, Storage storage = null)
|
||||
private readonly Func<OsuDbContext> contextSource;
|
||||
|
||||
protected OsuDbContext Context => contextSource();
|
||||
|
||||
protected DatabaseBackedStore(Func<OsuDbContext> contextSource, Storage storage = null)
|
||||
{
|
||||
Storage = storage;
|
||||
Context = context;
|
||||
this.contextSource = contextSource;
|
||||
|
||||
try
|
||||
{
|
||||
|
19
osu.Game/Database/DatabaseContextFactory.cs
Normal file
19
osu.Game/Database/DatabaseContextFactory.cs
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
|
||||
|
||||
using osu.Framework.Platform;
|
||||
|
||||
namespace osu.Game.Database
|
||||
{
|
||||
public class DatabaseContextFactory
|
||||
{
|
||||
private readonly GameHost host;
|
||||
|
||||
public DatabaseContextFactory(GameHost host)
|
||||
{
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
public OsuDbContext GetContext() => new OsuDbContext(host.Storage.GetDatabaseConnectionString(@"client"));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user