1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-19 10:12:53 +08:00

Tidy up some linq.

This commit is contained in:
Dean Herbert 2016-11-22 17:21:42 +09:00
parent a251db804c
commit 2ba365657e

View File

@ -136,7 +136,7 @@ namespace osu.Game.Database
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)
@ -175,10 +175,10 @@ namespace osu.Game.Database
return connection.GetWithChildren<T>(id);
}
public List<T> GetAllWithChildren<T>(Expression<Func<T, bool>> filter = null,
bool recursive = true) where T : class
public List<T> GetAllWithChildren<T>(Expression<Func<T, bool>> filter = null, bool recursive = true)
where T : class
{
return connection.GetAllWithChildren<T>(filter, recursive);
return connection.GetAllWithChildren(filter, recursive);
}
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
{
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");
if (cascade)
connection.UpdateWithChildren(record);