Пример #1
0
        private static void FillGenerated()
        {
            var account = new Account();
            var query   = new FilterQuery();

            query.fnamesIndexes = new HList <ushort> {
                1
            };
            foreach (var combination in combinations())
            {
                //TODO: Sort predicate by heavyness
                Predicate predicate = CreateDelegate(combination);
                predicate(account, query); //Force method compilations
                Cache.Add(combination, predicate);
            }
        }
Пример #2
0
        public static bool TryParse(IQueryCollection query, ref FilterQuery filterQuery)
        {
            if (filterQuery == null)
            {
                filterQuery = new FilterQuery();
            }
            else
            {
                filterQuery.Reset();
            }

            foreach (KeyValuePair <string, StringValues> kvp in query)
            {
                if (!Parameters.TryGetValue(kvp.Key, out Parser <AbstractQuery> parser) || !parser(filterQuery, kvp.Value))
                {
                    return(false);
                }
            }

            return(true);
        }