mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Use RealmContextFactory
instead of EF
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user