aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations/Extensions/ExpressionExtensions.cs
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2026-08-01 08:07:05 -0400
committerGitHub <noreply@github.com>2026-08-01 08:07:05 -0400
commit030031dcff5bb5d11f88f7e6c4e2361b35c2cb7e (patch)
tree49f015e5996fe6ddb2da9079a34137dc823cdf62 /Jellyfin.Server.Implementations/Extensions/ExpressionExtensions.cs
parent341c19bacebfeb4e957adfa75094c6a8febfc155 (diff)
parentd64e18b69a0a6089aab350f33464f362f09de942 (diff)
Merge pull request #17463 from Shadowghost/fix-unplayed-filter
Fix (Un)Played filter correctness and performance
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>