Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.

Example of Any #17

Open
QuantumSingularity opened this issue Sep 20, 2019 · 0 comments
Open

Example of Any #17

QuantumSingularity opened this issue Sep 20, 2019 · 0 comments

Comments

@QuantumSingularity
Copy link

Hi Vladislav,

Can you give me an example of the Any operator?
I'd like to filter on a few items, with id 1,2,3.

I'm trying with:
new TreeFilter
{
Field = "Id",
FilterType = WhereFilterType.Any,
Value = new List() {1,2,3}
}

But I get as a result:
Sequence contains no elements
at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
at ShareIt.Web.Common.QueryFilter.Expressions.WhereExpression.GenerateExpressionOneField(Expression prop, WhereFilter filter) in D:\ProjectsGit\ShareIt.Web\ShareIt.Web.Common.QueryFilter\Expressions\WhereExpression.cs
at ShareIt.Web.Common.QueryFilter.Expressions.WhereExpression.GetExpressionForField(Expression e, WhereFilter filter, String suffix) in D:\ProjectsGit\ShareIt.Web\ShareIt.Web.Common.QueryFilter\Expressions\WhereExpression.cs

In the piece of code:
case WhereFilterType.Any:
if (IsEnumerable(prop))
prop = AsQueryable(prop);
var ca = CollectionAny.MakeGenericMethod(
prop.Type.GenericTypeArguments.First());
return Expression.Call(ca, prop);

Any idea?

regards,
Bas.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant