コード例 #1
0
 private static IExpressionEvaluator <long> LongArrayEvaluator(TermExpression term)
 {
     if (!String.Equals(term.PropertyName, "Value", StringComparison.OrdinalIgnoreCase))
     {
         throw new QueryParseException($"Name {term.PropertyName} unknown in term {term}. 'Value' is the only valid name.");
     }
     return(new LongEvaluator <long>(l => l, term));
 }
コード例 #2
0
        public static IExpressionEvaluator <SampleItem> Evaluator(TermExpression term)
        {
            switch (term.PropertyName.ToLowerInvariant())
            {
            case "id":
                return(new LongEvaluator <SampleItem>(i => i.ID, term));

            case "state":
                return(new EnumEvaluator <SampleItem, State>(i => i.State, term));

            case "uri":
                return(new StringEvaluator <SampleItem>(i => i.Uri, term, StringComparison.OrdinalIgnoreCase));

            case "inprogress":
                return(new BoolEvaluator <SampleItem>(i => i.InProgress, term));

            default:
                throw new QueryParseException($"Property Name {term.PropertyName} unrecognized. Known Names: ID, State, Uri");
            }
        }