private static QueryContainer GetQuery( IComparator c, IFilterField filter) { return(c switch { AnyWordComparator aw => GetQuery(aw, filter), BetweenComparator bw => GetQuery(bw, filter), EqualComparator eq => GetQuery(eq, filter), FullPhraseComparator full => GetQuery(full, filter), GreaterThanComparator gt => GetQuery(gt, filter), GreaterThanOrEqualComparator gte => GetQuery(gte, filter), LessThanComparator lt => GetQuery(lt, filter), LessThanOrEqualComparator lte => GetQuery(lte, filter), NotAnyWordComparator naw => GetQuery(naw, filter), NotEqualComparator neq => GetQuery(neq, filter), PartialPhraseComparator part => GetQuery(part, filter), _ => throw new TypeAccessException($"Type {c.GetType().FullName} not recognized as a valid comparator.") });
internal static IComparatorRunner CreateRunner(this IComparator me) { return((IComparatorRunner)Activator.CreateInstance(typeof(ComparatorRunner <, ,>).MakeGenericType(me.GetType().GetTypeInfo().GenericTypeArguments), me)); }