mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
Use RealmContextFactory
instead of EF
This commit is contained in:
parent
83cbee39de
commit
89d6ffa7f3
@ -167,7 +167,7 @@ namespace osu.Game.Tests.Online
|
||||
|
||||
public Task<ILive<BeatmapSetInfo>> CurrentImportTask { get; private set; }
|
||||
|
||||
public TestBeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, [NotNull] AudioManager audioManager, IResourceStore<byte[]> resources, GameHost host = null, WorkingBeatmap defaultBeatmap = null)
|
||||
public TestBeatmapManager(Storage storage, RealmContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, [NotNull] AudioManager audioManager, IResourceStore<byte[]> resources, GameHost host = null, WorkingBeatmap defaultBeatmap = null)
|
||||
: base(storage, contextFactory, rulesets, api, audioManager, resources, host, defaultBeatmap)
|
||||
{
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ namespace osu.Game.Beatmaps
|
||||
private readonly WorkingBeatmapCache workingBeatmapCache;
|
||||
private readonly BeatmapOnlineLookupQueue onlineBeatmapLookupQueue;
|
||||
|
||||
public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, [NotNull] AudioManager audioManager, IResourceStore<byte[]> gameResources, GameHost host = null, WorkingBeatmap defaultBeatmap = null, bool performOnlineLookups = false)
|
||||
public BeatmapManager(Storage storage, RealmContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, [NotNull] AudioManager audioManager, IResourceStore<byte[]> gameResources, GameHost host = null, WorkingBeatmap defaultBeatmap = null, bool performOnlineLookups = false)
|
||||
{
|
||||
var userResources = new FileStore(contextFactory, storage).Store;
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Scoring
|
||||
private readonly OsuConfigManager configManager;
|
||||
private readonly ScoreModelManager scoreModelManager;
|
||||
|
||||
public ScoreManager(RulesetStore rulesets, Func<BeatmapManager> beatmaps, Storage storage, IDatabaseContextFactory contextFactory, Scheduler scheduler,
|
||||
public ScoreManager(RulesetStore rulesets, Func<BeatmapManager> beatmaps, Storage storage, RealmContextFactory contextFactory, Scheduler scheduler,
|
||||
IIpcHost importHost = null, Func<BeatmapDifficultyCache> difficulties = null, OsuConfigManager configManager = null)
|
||||
{
|
||||
this.scheduler = scheduler;
|
||||
|
@ -73,9 +73,9 @@ namespace osu.Game.Tests.Visual
|
||||
/// <remarks>
|
||||
/// In interactive runs (ie. VisualTests) this will use the user's database if <see cref="UseFreshStoragePerRun"/> is not set to <c>true</c>.
|
||||
/// </remarks>
|
||||
protected DatabaseContextFactory ContextFactory => contextFactory.Value;
|
||||
protected RealmContextFactory ContextFactory => contextFactory.Value;
|
||||
|
||||
private Lazy<DatabaseContextFactory> contextFactory;
|
||||
private Lazy<RealmContextFactory> contextFactory;
|
||||
|
||||
/// <summary>
|
||||
/// Whether a fresh storage should be initialised per test (method) run.
|
||||
@ -117,14 +117,7 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
Resources = parent.Get<OsuGameBase>().Resources;
|
||||
|
||||
contextFactory = new Lazy<DatabaseContextFactory>(() =>
|
||||
{
|
||||
var factory = new DatabaseContextFactory(LocalStorage);
|
||||
|
||||
using (var usage = factory.Get())
|
||||
usage.Migrate();
|
||||
return factory;
|
||||
});
|
||||
contextFactory = new Lazy<RealmContextFactory>(() => new RealmContextFactory(LocalStorage, "client"));
|
||||
|
||||
RecycleLocalStorage(false);
|
||||
|
||||
@ -301,8 +294,9 @@ namespace osu.Game.Tests.Visual
|
||||
if (MusicController?.TrackLoaded == true)
|
||||
MusicController.Stop();
|
||||
|
||||
if (contextFactory?.IsValueCreated == true)
|
||||
contextFactory.Value.ResetDatabase();
|
||||
// TODO: what should we do here, if anything? should we use an in-memory realm in this instance?
|
||||
// if (contextFactory?.IsValueCreated == true)
|
||||
// contextFactory.Value.ResetDatabase();
|
||||
|
||||
RecycleLocalStorage(true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user