2018-02-12 16:55:11 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Database
|
|
|
|
|
{
|
2018-02-12 22:10:05 +08:00
|
|
|
|
public class SingletonContextFactory : IDatabaseContextFactory
|
2018-02-12 16:55:11 +08:00
|
|
|
|
{
|
|
|
|
|
private readonly OsuDbContext context;
|
|
|
|
|
|
|
|
|
|
public SingletonContextFactory(OsuDbContext context)
|
|
|
|
|
{
|
|
|
|
|
this.context = context;
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-12 22:10:05 +08:00
|
|
|
|
public OsuDbContext Get() => context;
|
|
|
|
|
|
|
|
|
|
public DatabaseWriteUsage GetForWrite() => new DatabaseWriteUsage(context, null);
|
2018-02-12 16:55:11 +08:00
|
|
|
|
}
|
|
|
|
|
}
|