/// <summary> /// Process a parameter that passes criteria to the filter. /// </summary> /// <param name="filter">The filter to invoke.</param> /// <param name="value">The criteria to pass to the filter.</param> /// <typeparam name="TCriteria">The type of the criteria.</typeparam> protected void ProcessParameter <TCriteria>( FilterFrame <TMemberType> .ReflectionFilter filter, TCriteria value) { if (value == null) { return; } Filters.Add(CreateFrame(filter, value)); }
/// <summary> /// Process an input parameter for a filter with no criteria. /// </summary> /// <param name="filter">The filter to invoke.</param> /// <param name="shouldAdd">A value indicating if the filter should be added.</param> protected void ProcessParameter( FilterFrame <TMemberType> .ReflectionFilter filter, bool shouldAdd) { if (!shouldAdd) { return; } Filters.Add(CreateFrame(filter, null)); }
/// <summary> /// Process a string parameter that supports wildcards. If the RegularExpressions input /// parameter is specified, the regexMethod will be used. Otherwise the wildcard method. /// </summary> /// <param name="pattern">The pattern to match.</param> /// <param name="wildcardMethod">The filter to use for wildcard matching.</param> /// <param name="regexMethod">The filter to use for regex matching.</param> protected void ProcessName( string pattern, FilterFrame <TMemberType> .ReflectionFilter wildcardMethod, FilterFrame <TMemberType> .ReflectionFilter regexMethod) { if (pattern == null) { return; } if (RegularExpression.IsPresent) { var regexPattern = new Regex(pattern, RegexOptions.IgnoreCase); Filters.Add(CreateFrame(regexMethod, regexPattern)); return; } var wildcardPattern = new WildcardPattern(pattern, WildcardOptions.IgnoreCase); Filters.Add(CreateFrame(wildcardMethod, wildcardPattern)); }
/// <summary> /// Creates a filter frame to add to the filter list. /// </summary> /// <param name="filter">The filter to invoke.</param> /// <param name="filterCriteria">The criteria to pass to the filter.</param> /// <returns>The created filter frame.</returns> protected FilterFrame <TMemberType> CreateFrame( FilterFrame <TMemberType> .ReflectionFilter filter, object filterCriteria) { return(new FilterFrame <TMemberType>(filter, filterCriteria)); }