void ICollectionPropertyBagVisitor.Visit <TCollection, TElement>(ICollectionPropertyBag <TCollection, TElement> properties, ref TCollection container) { var path = Path; // This query engine filter is provided with two delegates: // // parameterTransformer: This function is responsible for transforming the input string into a strong generic type. // this is done via the `TypeConversion` API in properties. // // filterResolver: This function takes the data for each element being filtered, along with the original token, and the // transformed input. The function then applies the filter and returns true or false. In this particular case // we want to test equality with each collection element and return true if ANY match. // QueryEngine.AddFilter <TElement, TElement>(Token, (data, _, token, transformedInput) => { if (!PropertyContainer.TryGetValue <TData, TCollection>(ref data, path, out var collection)) { return(false); } if (RuntimeTypeInfoCache <TCollection> .CanBeNull && null == collection) { return(false); } return(collection.Any(e => FilterOperator.ApplyOperator(token, e, transformedInput, QueryEngine.globalStringComparison))); }, s => TypeConversion.Convert <string, TElement>(ref s), FilterOperator.GetSupportedOperators <TElement>()); }
void ICollectionPropertyBagVisitor.Visit <TCollection, TElement>(ICollectionPropertyBag <TCollection, TElement> properties, ref TCollection container) { if (null == container) { return; } foreach (var element in container) { SearchData.Add(element?.ToString()); } }