Try our conversational search powered by Generative AI!

When to use DelegateFilterBuilder over FilterExpression

Vote:
 

Hi,

When would one use DelegateFilterBuilder instead of FilterExpression (and vice versa)? E.g. I can achieve same (sort of) functionality with:

public static FilterExpression In(this ContentReference value, IEnumerable values)
{
    var ids = values.Select(x => x.ID);

    return new FilterExpression(x => x.ID.In(ids));
}

and:

public static DelegateFilterBuilder In(this ContentReference value, IEnumerable values)
{
    var ids = values.Select(x => x.ID);

    var fieldFilterValues = ids.Select(FieldFilterValue.Create);

    return new DelegateFilterBuilder(field => new TermsFilter(field + ".ID$$number", fieldFilterValues));
}

Another question regarding my last code snippet, is there a way to express the ID property of a ContentReference without the ugly string concatenation?

#175838
Edited, Mar 03, 2017 16:33
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.