From 2ba365657ebb8f49f6b1fe25687dcda3ae02756e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 22 Nov 2016 17:21:42 +0900 Subject: [PATCH] Tidy up some linq. --- osu.Game/Database/BeatmapDatabase.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index aa68a3be15..f6e67202aa 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -136,7 +136,7 @@ namespace osu.Game.Database public BeatmapSetInfo GetBeatmapSet(int id) { - return Query().Where(s => s.BeatmapSetID == id).FirstOrDefault(); + return Query().FirstOrDefault(s => s.BeatmapSetID == id); } public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null) @@ -175,10 +175,10 @@ namespace osu.Game.Database return connection.GetWithChildren(id); } - public List GetAllWithChildren(Expression> filter = null, - bool recursive = true) where T : class + public List GetAllWithChildren(Expression> filter = null, bool recursive = true) + where T : class { - return connection.GetAllWithChildren(filter, recursive); + return connection.GetAllWithChildren(filter, recursive); } public T GetChildren(T item, bool recursive = true) @@ -199,7 +199,7 @@ namespace osu.Game.Database public void Update(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);