mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 17:37:23 +09:00
Merge pull request #15850 from peppy/realm-integration/misc-qol
Apply a couple of realm related documentation/interface changes
This commit is contained in:
commit
8a188b74b1
@ -67,7 +67,7 @@ namespace osu.Game.Tests.Database
|
|||||||
{
|
{
|
||||||
RunTestWithRealm((realmFactory, _) =>
|
RunTestWithRealm((realmFactory, _) =>
|
||||||
{
|
{
|
||||||
RealmLive<RealmBeatmap>? liveBeatmap = null;
|
ILive<RealmBeatmap>? liveBeatmap = null;
|
||||||
Task.Factory.StartNew(() =>
|
Task.Factory.StartNew(() =>
|
||||||
{
|
{
|
||||||
using (var threadContext = realmFactory.CreateContext())
|
using (var threadContext = realmFactory.CreateContext())
|
||||||
@ -104,7 +104,7 @@ namespace osu.Game.Tests.Database
|
|||||||
{
|
{
|
||||||
RunTestWithRealm((realmFactory, _) =>
|
RunTestWithRealm((realmFactory, _) =>
|
||||||
{
|
{
|
||||||
RealmLive<RealmBeatmap>? liveBeatmap = null;
|
ILive<RealmBeatmap>? liveBeatmap = null;
|
||||||
Task.Factory.StartNew(() =>
|
Task.Factory.StartNew(() =>
|
||||||
{
|
{
|
||||||
using (var threadContext = realmFactory.CreateContext())
|
using (var threadContext = realmFactory.CreateContext())
|
||||||
@ -133,7 +133,7 @@ namespace osu.Game.Tests.Database
|
|||||||
{
|
{
|
||||||
RunTestWithRealm((realmFactory, _) =>
|
RunTestWithRealm((realmFactory, _) =>
|
||||||
{
|
{
|
||||||
RealmLive<RealmBeatmap>? liveBeatmap = null;
|
ILive<RealmBeatmap>? liveBeatmap = null;
|
||||||
Task.Factory.StartNew(() =>
|
Task.Factory.StartNew(() =>
|
||||||
{
|
{
|
||||||
using (var threadContext = realmFactory.CreateContext())
|
using (var threadContext = realmFactory.CreateContext())
|
||||||
@ -159,7 +159,7 @@ namespace osu.Game.Tests.Database
|
|||||||
{
|
{
|
||||||
RunTestWithRealm((realmFactory, _) =>
|
RunTestWithRealm((realmFactory, _) =>
|
||||||
{
|
{
|
||||||
RealmLive<RealmBeatmap>? liveBeatmap = null;
|
ILive<RealmBeatmap>? liveBeatmap = null;
|
||||||
Task.Factory.StartNew(() =>
|
Task.Factory.StartNew(() =>
|
||||||
{
|
{
|
||||||
using (var threadContext = realmFactory.CreateContext())
|
using (var threadContext = realmFactory.CreateContext())
|
||||||
@ -192,7 +192,7 @@ namespace osu.Game.Tests.Database
|
|||||||
using (var updateThreadContext = realmFactory.CreateContext())
|
using (var updateThreadContext = realmFactory.CreateContext())
|
||||||
{
|
{
|
||||||
updateThreadContext.All<RealmBeatmap>().SubscribeForNotifications(gotChange);
|
updateThreadContext.All<RealmBeatmap>().SubscribeForNotifications(gotChange);
|
||||||
RealmLive<RealmBeatmap>? liveBeatmap = null;
|
ILive<RealmBeatmap>? liveBeatmap = null;
|
||||||
|
|
||||||
Task.Factory.StartNew(() =>
|
Task.Factory.StartNew(() =>
|
||||||
{
|
{
|
||||||
|
@ -49,13 +49,13 @@ namespace osu.Game.Database
|
|||||||
return mapper.Map<T>(item);
|
return mapper.Map<T>(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<RealmLive<T>> ToLive<T>(this IEnumerable<T> realmList)
|
public static List<ILive<T>> ToLive<T>(this IEnumerable<T> realmList)
|
||||||
where T : RealmObject, IHasGuidPrimaryKey
|
where T : RealmObject, IHasGuidPrimaryKey
|
||||||
{
|
{
|
||||||
return realmList.Select(l => new RealmLive<T>(l)).ToList();
|
return realmList.Select(l => new RealmLive<T>(l)).Cast<ILive<T>>().ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RealmLive<T> ToLive<T>(this T realmObject)
|
public static ILive<T> ToLive<T>(this T realmObject)
|
||||||
where T : RealmObject, IHasGuidPrimaryKey
|
where T : RealmObject, IHasGuidPrimaryKey
|
||||||
{
|
{
|
||||||
return new RealmLive<T>(realmObject);
|
return new RealmLive<T>(realmObject);
|
||||||
|
@ -16,6 +16,7 @@ namespace osu.Game.Models
|
|||||||
{
|
{
|
||||||
public RealmFile File { get; set; } = null!;
|
public RealmFile File { get; set; } = null!;
|
||||||
|
|
||||||
|
// [Indexed] cannot be used on `EmbeddedObject`s as it only applies to top-level queries. May need to reconsider this if performance becomes a concern.
|
||||||
public string Filename { get; set; } = null!;
|
public string Filename { get; set; } = null!;
|
||||||
|
|
||||||
public RealmNamedFileUsage(RealmFile file, string filename)
|
public RealmNamedFileUsage(RealmFile file, string filename)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user