Skip to content

Commit

Permalink
Merge pull request #16 from RicardoZambon/fix/queryable-extension-like
Browse files Browse the repository at this point in the history
fix: Queryable extensions TryFilter was not working properly with fil…
  • Loading branch information
RicardoZambon authored Jun 21, 2024
2 parents 97f99aa + cb310f1 commit 869966c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ZWebAPI/ExtensionMethods/QueryableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ private static string GetParameterName(MemberExpression? memberExpression)

private static IQueryable<TEntity> RunFilter<TEntity>(this IQueryable<TEntity> query, ParameterExpression parameter, MemberExpression memberExpression, object? filterValue, FilterTypes filterType)
{
if (filterType == FilterTypes.Like)
{
filterValue = $"%{filterValue}%";
}

UnaryExpression value = Expression.Convert(Expression.Constant(filterValue), memberExpression.Type);

Expression<Func<TEntity, bool>>? where = null;
Expand Down

0 comments on commit 869966c

Please sign in to comment.