protected virtual Expression VisitStringPatternCheckMethodCall(Expression source, Expression match, string pattern, string methodName, bool notMatch = false) { var matched = Visit(match); if ((source is MemberExpression || source is MethodCallExpression) && matched is ConstantExpression) { if (Mapping.TryGetFieldName(SourceType, source, out string field)) { var value = ((ConstantExpression)matched).Value; IsPropertyHasKeyword(field, out field); var wildcardCriteria = new WildCardCriteria(string.Format(pattern, value), field); return(new CriteriaExpression(!notMatch? wildcardCriteria: NotCriteria.Create(wildcardCriteria))); } } throw new NotSupportedException(source is MemberExpression ? $"Match '{match}' in Contains operation must be a constant" : $"Unknown source '{source}' for Contains operation"); }
static JObject Build(WildCardCriteria criteria) { return(new JObject( new JProperty(criteria.Name, new JObject( new JProperty(criteria.Field, criteria.Value))))); }