public Task BindModelAsync(ModelBindingContext bindingContext)
        {
            if (!bindingContext.ModelMetadata.IsEnumerableType)
            {
                bindingContext.Result = ModelBindingResult.Failed();
                return(Task.CompletedTask);
            }

            string routeParam = Convert.ToString(bindingContext.ValueProvider.GetValue(bindingContext.ModelName));

            if (string.IsNullOrWhiteSpace(routeParam))
            {
                bindingContext.Result = ModelBindingResult.Failed();
                return(Task.CompletedTask);
            }

            var type = bindingContext.ModelType.GenericTypeArguments[0];

            var typedList = _listProvider.GetTypedList(
                routeParam.Split(',', StringSplitOptions.RemoveEmptyEntries), type, typeof(KeyList <>));

            bindingContext.Model  = typedList;
            bindingContext.Result = ModelBindingResult.Success(bindingContext.Model);

            return(Task.CompletedTask);
        }
        private Expression BuildInExpression(Expression member, QueryLogicalFilter logicalFilter, bool isIn)
        {
            var typedList      = _listProvider.GetTypedList(logicalFilter.Filter.Values, member.Type, typeof(List <>));
            var listExpression = Expression.Constant(typedList);
            var containsMethod = typedList.GetType().GetMethod("Contains", new Type[] { member.Type });

            return(Expression.Equal(Expression.Call(listExpression, containsMethod, member), Expression.Constant(isIn)));
        }