mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Return back DatabaseBackedStore's query and populate functions
This commit is contained in:
@ -2,9 +2,7 @@
|
||||
// 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;
|
||||
|
||||
@ -134,45 +132,5 @@ 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