Skip to content

v0.4.1

Compare
Choose a tag to compare
@Namoshek Namoshek released this 01 Apr 14:16
· 82 commits to master since this release

Fixes

  • SearchPredicate, ColumnSearchPredicate and GlobalSearchPredicate now work with nested expressions where the parameter replacement of the search value did not work properly before.

    Example which didn't work but works now:
    SearchPredicate = (p, s) => p.EmailAddresses.Any(e => e.Address.Contains(s))
    Before the fix, the parameter s has not been replaced in the inner expression e => e.Address.Contains(s) properly. Now, instead of replacing the parameter, we simply wrap the expression in another expression and pass the search value as constant to the inner expression:

    var entityParam = expr.Parameters.Single(p => p.Type == typeof(TEntity));
    var searchValueConstant = Expression.Constant(searchValue);
    expr = (Expression<Func<TEntity, bool>>)Expression.Lambda(
        Expression.Invoke(expr, entityParam, searchValueConstant), entityParam);