Skip to content

Commit

Permalink
fix: invoke expression1 before combining
Browse files Browse the repository at this point in the history
  • Loading branch information
melflitty-aneo committed Jul 31, 2023
1 parent 347723b commit 08a1ee5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Common/src/gRPC/ExpressionExt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ public static class ExpressionExt
public static Expression<Func<T, bool>> ExpressionAnd<T>(this Expression<Func<T, bool>> expr1,
Expression<Func<T, bool>> expr2)
=> Expression.Lambda<Func<T, bool>>(Expression.AndAlso(expr1.Body,
expr2.Body),
expr2.Parameters);
Expression.Invoke(expr2,
expr1.Parameters)),
expr1.Parameters);

/// <summary>
/// Combines two predicate expressions using a logical OR condition
Expand All @@ -43,6 +44,7 @@ public static Expression<Func<T, bool>> ExpressionAnd<T>(this Expression<Func<T,
public static Expression<Func<T, bool>> ExpressionOr<T>(this Expression<Func<T, bool>> expr1,
Expression<Func<T, bool>> expr2)
=> Expression.Lambda<Func<T, bool>>(Expression.OrElse(expr1.Body,
expr2.Body),
expr2.Parameters);
Expression.Invoke(expr2,
expr1.Parameters)),
expr1.Parameters);
}

0 comments on commit 08a1ee5

Please sign in to comment.