aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations/Extensions/ExpressionExtensions.cs
diff options
context:
space:
mode:
authorShadowghost <Ghost_of_Stone@web.de>2026-08-01 21:41:16 +0200
committerShadowghost <Ghost_of_Stone@web.de>2026-08-01 21:41:16 +0200
commit705368ee495cfb8967d3f1651318fbdb85ad89e6 (patch)
treed0c99252541c73ddeaddb036079a00808ab9a955 /Jellyfin.Server.Implementations/Extensions/ExpressionExtensions.cs
parentcbc2c7c32345f670d928f7840e5fd7422241845d (diff)
parente16c8a07bd8e21973a88231eeed83c9699fd58b2 (diff)
Merge remote-tracking branch 'upstream/master' into fix-byname-queries
# Conflicts: # src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/JellyfinDbModelSnapshot.cs
Diffstat (limited to 'Jellyfin.Server.Implementations/Extensions/ExpressionExtensions.cs')
-rw-r--r--Jellyfin.Server.Implementations/Extensions/ExpressionExtensions.cs13
1 files changed, 13 insertions, 0 deletions
diff --git a/Jellyfin.Server.Implementations/Extensions/ExpressionExtensions.cs b/Jellyfin.Server.Implementations/Extensions/ExpressionExtensions.cs
index d70ac672f2..0f166fc6e0 100644
--- a/Jellyfin.Server.Implementations/Extensions/ExpressionExtensions.cs
+++ b/Jellyfin.Server.Implementations/Extensions/ExpressionExtensions.cs
@@ -40,6 +40,19 @@ public static class ExpressionExtensions
}
/// <summary>
+ /// Negates a predicate.
+ /// </summary>
+ /// <typeparam name="T">The predicate parameter type.</typeparam>
+ /// <param name="predicate">The predicate expression to negate.</param>
+ /// <returns>A new expression representing the negation of the input predicate.</returns>
+ public static Expression<Func<T, bool>> Not<T>(this Expression<Func<T, bool>> predicate)
+ {
+ ArgumentNullException.ThrowIfNull(predicate);
+
+ return Expression.Lambda<Func<T, bool>>(Expression.Not(predicate.Body), predicate.Parameters);
+ }
+
+ /// <summary>
/// Combines two predicates into a single predicate using a logical AND operation.
/// </summary>
/// <typeparam name="T">The predicate parameter type.</typeparam>