Exemplo n.º 1
0
        internal static Filter PrependToken(Filter filter, QueryToken prefix)
        {
            if (filter is FilterCondition fc)
            {
                return(new FilterCondition(prefix.Append(fc.Token), fc.Operation, fc.Value));
            }

            if (filter is FilterGroup fg)
            {
                return(new FilterGroup(fg.GroupOperation, fg.Token == null ? null : prefix.Append(fg.Token),
                                       fg.Filters.Select(f => PrependToken(f, prefix)).ToList()));
            }

            throw new UnexpectedValueException(filter);
        }
Exemplo n.º 2
0
        private static Filter ToFilterAppend(QueryFilterEmbedded f, QueryToken mainQueryKey)
        {
            QueryToken token = mainQueryKey.Append(f.Token.Token);

            return(new Filter(token, f.Operation,
                              FilterValueConverter.Parse(f.ValueString, token.Type, f.Operation.IsList())));
        }