public static Criteria <TItem> equalTo <TItem, TProperty>(this CriteriaBuilder <TItem, TProperty> builder,
                                                              TProperty value)
    {
        var criteria = new AnonymousPredicate <TItem>(p => builder._propertyExtractor(p).Equals(value));

        if (builder.neg)
        {
            return(new Negation <TItem>(criteria));
        }

        return(criteria);
    }
    public static Criteria <TItem> greaterThan <TItem, TProperty>(this CriteriaBuilder <TItem, TProperty> builder,
                                                                  TProperty value)
        where TProperty : IComparable <TProperty>
    {
        var criteria = new AnonymousPredicate <TItem>(p => value.CompareTo(builder._propertyExtractor(p)) < 0);

        if (builder.neg)
        {
            return(new Negation <TItem>(criteria));
        }

        return(criteria);
    }
    public static Criteria <TItem> equalToAny <TItem, TProperty>(this CriteriaBuilder <TItem, TProperty> builder,
                                                                 params TProperty[] values)
    {
        var allowedvalues = new List <TProperty>(values);
        var criteria      = new AnonymousPredicate <TItem>(p => allowedvalues.Contains(builder._propertyExtractor(p)));

        if (builder.neg)
        {
            return(new Negation <TItem>(criteria));
        }

        return(criteria);
    }