public Expression ToExpression(FilterBuildExpressionContext ctx)
{
var collection = Token.Parent.BuildExpression(ctx);
var and = Filters.Select(f => f.ToExpression(ctx)).AggregateAnd();
string type = Token.CollectionElementType.ToString();
if (type.StartsWith("AnyNo"))
and = Expression.Not(and);
var lambda = Expression.Lambda(and, Parameter);
MethodInfo mi = typeof(IQueryable).IsAssignableFrom(Token.Parent.Type) ?
(type.StartsWith("All") ? miAllQ : miAnyQ) :
(type.StartsWith("All") ? miAllE : miAnyE);
var result = Expression.Call(mi.MakeGenericMethod(Parameter.Type), collection, lambda);
if (type.StartsWith("NoOne"))
return Expression.Not(result);
return result;
}
}