aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs
diff options
context:
space:
mode:
authorClaus Vium <cvium@users.noreply.github.com>2022-03-11 08:15:12 +0100
committerGitHub <noreply@github.com>2022-03-11 08:15:12 +0100
commit53209830e7b566949c16b43c864f6f85336cb92c (patch)
tree59a99d347cffe722da175269dfd99bac08fb7fb0 /Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs
parent21ef6661d6ef48fb18da10b8e0abf2c1d1345ed1 (diff)
parentf50a250cd9fac47bcbd9a05e99c8ffe4d294e320 (diff)
Merge pull request #7346 from Bond-009/guid
Optimize Guid comparisons
Diffstat (limited to 'Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs')
-rw-r--r--Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs14
1 files changed, 7 insertions, 7 deletions
diff --git a/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs b/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs
index c89e3c74d..f5d38db20 100644
--- a/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs
+++ b/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs
@@ -32,7 +32,7 @@ namespace Jellyfin.Server.Implementations.Users
var prefs = _dbContext.DisplayPreferences
.Include(pref => pref.HomeSections)
.FirstOrDefault(pref =>
- pref.UserId == userId && string.Equals(pref.Client, client) && pref.ItemId == itemId);
+ pref.UserId.Equals(userId) && string.Equals(pref.Client, client) && pref.ItemId.Equals(itemId));
if (prefs == null)
{
@@ -47,7 +47,7 @@ namespace Jellyfin.Server.Implementations.Users
public ItemDisplayPreferences GetItemDisplayPreferences(Guid userId, Guid itemId, string client)
{
var prefs = _dbContext.ItemDisplayPreferences
- .FirstOrDefault(pref => pref.UserId == userId && pref.ItemId == itemId && string.Equals(pref.Client, client));
+ .FirstOrDefault(pref => pref.UserId.Equals(userId) && pref.ItemId.Equals(itemId) && string.Equals(pref.Client, client));
if (prefs == null)
{
@@ -63,7 +63,7 @@ namespace Jellyfin.Server.Implementations.Users
{
return _dbContext.ItemDisplayPreferences
.AsQueryable()
- .Where(prefs => prefs.UserId == userId && prefs.ItemId != Guid.Empty && string.Equals(prefs.Client, client))
+ .Where(prefs => prefs.UserId.Equals(userId) && !prefs.ItemId.Equals(default) && string.Equals(prefs.Client, client))
.ToList();
}
@@ -72,8 +72,8 @@ namespace Jellyfin.Server.Implementations.Users
{
return _dbContext.CustomItemDisplayPreferences
.AsQueryable()
- .Where(prefs => prefs.UserId == userId
- && prefs.ItemId == itemId
+ .Where(prefs => prefs.UserId.Equals(userId)
+ && prefs.ItemId.Equals(itemId)
&& string.Equals(prefs.Client, client))
.ToDictionary(prefs => prefs.Key, prefs => prefs.Value);
}
@@ -83,8 +83,8 @@ namespace Jellyfin.Server.Implementations.Users
{
var existingPrefs = _dbContext.CustomItemDisplayPreferences
.AsQueryable()
- .Where(prefs => prefs.UserId == userId
- && prefs.ItemId == itemId
+ .Where(prefs => prefs.UserId.Equals(userId)
+ && prefs.ItemId.Equals(itemId)
&& string.Equals(prefs.Client, client));
_dbContext.CustomItemDisplayPreferences.RemoveRange(existingPrefs);