mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 21:02:54 +08:00
Provide RealmContextFactory
with the EF RulesetStore
for migration purposes
This commit is contained in:
parent
d2062ff97f
commit
ca26b6c540
@ -13,6 +13,7 @@ using osu.Framework.Platform;
|
||||
using osu.Framework.Statistics;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Models;
|
||||
using osu.Game.Rulesets;
|
||||
using Realms;
|
||||
|
||||
#nullable enable
|
||||
@ -31,6 +32,8 @@ namespace osu.Game.Database
|
||||
/// </summary>
|
||||
public readonly string Filename;
|
||||
|
||||
private readonly RulesetStore? rulesets;
|
||||
|
||||
/// <summary>
|
||||
/// Version history:
|
||||
/// 6 ~2021-10-18 First tracked version.
|
||||
@ -72,9 +75,10 @@ namespace osu.Game.Database
|
||||
}
|
||||
}
|
||||
|
||||
public RealmContextFactory(Storage storage, string filename)
|
||||
public RealmContextFactory(Storage storage, string filename, RulesetStore? rulesets = null)
|
||||
{
|
||||
this.storage = storage;
|
||||
this.rulesets = rulesets;
|
||||
|
||||
Filename = filename;
|
||||
|
||||
|
@ -187,8 +187,9 @@ namespace osu.Game
|
||||
Resources.AddStore(new DllResourceStore(OsuResources.ResourceAssembly));
|
||||
|
||||
dependencies.Cache(contextFactory = new DatabaseContextFactory(Storage));
|
||||
dependencies.Cache(RulesetStore = new RulesetStore(contextFactory, Storage));
|
||||
|
||||
dependencies.Cache(realmFactory = new RealmContextFactory(Storage, "client"));
|
||||
dependencies.Cache(realmFactory = new RealmContextFactory(Storage, "client", RulesetStore));
|
||||
|
||||
dependencies.CacheAs(Storage);
|
||||
|
||||
@ -227,7 +228,6 @@ namespace osu.Game
|
||||
|
||||
var defaultBeatmap = new DummyWorkingBeatmap(Audio, Textures);
|
||||
|
||||
dependencies.Cache(RulesetStore = new RulesetStore(contextFactory, Storage));
|
||||
dependencies.Cache(fileStore = new FileStore(contextFactory, Storage));
|
||||
|
||||
// ordering is important here to ensure foreign keys rules are not broken in ModelStore.Cleanup()
|
||||
|
Loading…
Reference in New Issue
Block a user