mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 07:06:35 +09:00
Revert "Return back DatabaseBackedStore's query and populate functions"
This reverts commit 7cf5d63cd3
.
This commit is contained in:
@ -2,7 +2,9 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using osu.Game.Database;
|
||||
|
||||
@ -132,5 +134,45 @@ namespace osu.Game.Beatmaps
|
||||
{
|
||||
Connection.BeatmapSetInfo.RemoveRange(Connection.BeatmapSetInfo.Where(b => b.DeletePending && !b.Protected));
|
||||
}
|
||||
|
||||
public BeatmapSetInfo QueryBeatmapSet(Func<BeatmapSetInfo, bool> query)
|
||||
{
|
||||
return Connection.BeatmapSetInfo
|
||||
.Include(b => b.Metadata)
|
||||
.Include(b => b.Beatmaps).ThenInclude(b => b.Ruleset)
|
||||
.Include(b => b.Beatmaps).ThenInclude(b => b.Difficulty)
|
||||
.Include(b => b.Files).ThenInclude(f => f.FileInfo)
|
||||
.FirstOrDefault(query);
|
||||
}
|
||||
|
||||
public List<BeatmapSetInfo> QueryBeatmapSets(Expression<Func<BeatmapSetInfo, bool>> query)
|
||||
{
|
||||
return Connection.BeatmapSetInfo
|
||||
.Include(b => b.Metadata)
|
||||
.Include(b => b.Beatmaps).ThenInclude(b => b.Ruleset)
|
||||
.Include(b => b.Beatmaps).ThenInclude(b => b.Difficulty)
|
||||
.Include(b => b.Files).ThenInclude(f => f.FileInfo)
|
||||
.Where(query).ToList();
|
||||
}
|
||||
|
||||
public BeatmapInfo QueryBeatmap(Func<BeatmapInfo, bool> query)
|
||||
{
|
||||
return Connection.BeatmapInfo
|
||||
.Include(b => b.BeatmapSet)
|
||||
.Include(b => b.Metadata)
|
||||
.Include(b => b.Ruleset)
|
||||
.Include(b => b.Difficulty)
|
||||
.FirstOrDefault(query);
|
||||
}
|
||||
|
||||
public List<BeatmapInfo> QueryBeatmaps(Expression<Func<BeatmapInfo, bool>> query)
|
||||
{
|
||||
return Connection.BeatmapInfo
|
||||
.Include(b => b.BeatmapSet)
|
||||
.Include(b => b.Metadata)
|
||||
.Include(b => b.Ruleset)
|
||||
.Include(b => b.Difficulty)
|
||||
.Where(query).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user