Ejemplo n.º 1
0
 public bool Matches(long id)
 {
     if (GreaterThanOrEqual.HasValue && id >= GreaterThanOrEqual)
     {
         return(true);
     }
     return(IsOneOf.Contains(id));
 }
Ejemplo n.º 2
0
        public string GetSql(string idValue)
        {
            var ids = IsOneOf.ToArray();

            Array.Sort(ids);
            string idList = String.Join(",", ids.Select(id => id.ToString(CultureInfo.InvariantCulture)));

            if (GreaterThanOrEqual.HasValue)
            {
                if (IsOneOf.Count == 0)
                {
                    return(String.Format("({0} >= {1})", idValue, GreaterThanOrEqual));
                }
                return(String.Format("({0} >= {1} OR {0} IN ({2}))", idValue, GreaterThanOrEqual, idList));
            }
            return(String.Format("({0} IN ({1}))", idValue, idList));
        }
Ejemplo n.º 3
0
 public IdPredicate(long?greaterThanOrEqual, ICollection <long> isOneOf) : this()
 {
     GreaterThanOrEqual = greaterThanOrEqual;
     IsOneOf.UnionWith(isOneOf);
 }