mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 17:37:23 +09:00
Tidy up some linq.
This commit is contained in:
parent
a251db804c
commit
2ba365657e
@ -136,7 +136,7 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
public BeatmapSetInfo GetBeatmapSet(int id)
|
public BeatmapSetInfo GetBeatmapSet(int id)
|
||||||
{
|
{
|
||||||
return Query<BeatmapSetInfo>().Where(s => s.BeatmapSetID == id).FirstOrDefault();
|
return Query<BeatmapSetInfo>().FirstOrDefault(s => s.BeatmapSetID == id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null)
|
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null)
|
||||||
@ -175,10 +175,10 @@ namespace osu.Game.Database
|
|||||||
return connection.GetWithChildren<T>(id);
|
return connection.GetWithChildren<T>(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<T> GetAllWithChildren<T>(Expression<Func<T, bool>> filter = null,
|
public List<T> GetAllWithChildren<T>(Expression<Func<T, bool>> filter = null, bool recursive = true)
|
||||||
bool recursive = true) where T : class
|
where T : class
|
||||||
{
|
{
|
||||||
return connection.GetAllWithChildren<T>(filter, recursive);
|
return connection.GetAllWithChildren(filter, recursive);
|
||||||
}
|
}
|
||||||
|
|
||||||
public T GetChildren<T>(T item, bool recursive = true)
|
public T GetChildren<T>(T item, bool recursive = true)
|
||||||
@ -199,7 +199,7 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
public void Update<T>(T record, bool cascade = true) where T : class
|
public void Update<T>(T record, bool cascade = true) where T : class
|
||||||
{
|
{
|
||||||
if (!validTypes.Any(t => t == typeof(T)))
|
if (validTypes.All(t => t != typeof(T)))
|
||||||
throw new ArgumentException(nameof(T), "Must be a type managed by BeatmapDatabase");
|
throw new ArgumentException(nameof(T), "Must be a type managed by BeatmapDatabase");
|
||||||
if (cascade)
|
if (cascade)
|
||||||
connection.UpdateWithChildren(record);
|
connection.UpdateWithChildren(record);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user