Ejemplo n.º 1
0
 public bool ContainsKeys(IEnumerable<Guid> keys, ExpectationMode mode = ExpectationMode.Optimistic)
 {
     var matches = redis.As<AUDIO_ALARM>().GetAllKeys().Intersect(keys.Select(x => x.ToString())).ToList();
     if (matches.NullOrEmpty()) return false;
     return mode == ExpectationMode.Pessimistic
         ? matches.Count() == keys.Count()
         : !matches.NullOrEmpty();
 }
Ejemplo n.º 2
0
        public bool ContainsKeys(IEnumerable<Guid> keys, ExpectationMode mode = ExpectationMode.Optimistic)
        {
            var dkeys = keys.Distinct();
            using (var db = factory.OpenDbConnection())
            {

                return mode == ExpectationMode.Pessimistic || mode == ExpectationMode.Unknown
                    ? db.Count<VEVENT>(q => Sql.In(q.Id, dkeys)) == dkeys.Count()
                    : db.Count<VEVENT>(q => Sql.In(q.Id, dkeys)) != 0; 
            }
        }
Ejemplo n.º 3
0
 public bool ContainsKeys(IEnumerable<Guid> keys, ExpectationMode mode = ExpectationMode.Optimistic)
 {
     var dkeys = keys.Distinct().ToArray();
     if (mode == ExpectationMode.Pessimistic || mode == ExpectationMode.Unknown)
         return db.Count<EMAIL_ALARM>(q => Sql.In(q.Id, dkeys)) == dkeys.Count();
     return db.Count<EMAIL_ALARM>(q => Sql.In(q.Id, dkeys)) != 0;
 }
Ejemplo n.º 4
0
 /// <summary>
 ///     Checks if the repository contains entities
 /// </summary>
 /// <param name="keys">The unique identifiers of the entities</param>
 /// <param name="mode">
 ///     How the search is performed. Optimistic if at least one entity found, Pessimistic if all entities
 ///     are found
 /// </param>
 /// <returns>
 ///     True if the entities are found, otherwise false
 /// </returns>
 public bool ContainsKeys(IEnumerable<Guid> keys, ExpectationMode mode = ExpectationMode.Optimistic)
 {
     return mode == ExpectationMode.Pessimistic || mode == ExpectationMode.Unknown
         ? db.Count<AUDIO_ALARM>(q => Sql.In(q.Id, keys)) == keys.Count()
         : db.Count<AUDIO_ALARM>(q => Sql.In(q.Id, keys)) != 0;
 }
Ejemplo n.º 5
0
 public bool ContainsKeys(IEnumerable<Guid> keys, ExpectationMode mode = ExpectationMode.Optimistic)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 6
0
 public bool ContainsKeys(IEnumerable<Guid> keys, ExpectationMode mode = ExpectationMode.Optimistic)
 {
     var all = redis.As<VCALENDAR>().GetAllKeys();
     var matches = all.Intersect(keys.Select(x => UrnId.Create<VCALENDAR>(x)).ToList());
     if (matches.NullOrEmpty()) return false;
     return mode == ExpectationMode.Pessimistic
         ? matches.Count() == keys.Count()
         : !matches.NullOrEmpty();
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Checks if the repository contains entities
 /// </summary>
 /// <param name="keys">The unique identifiers of the entities</param>
 /// <param name="mode">How the search is performed. Optimistic if at least one entity found, Pessimistic if all entities are found</param>
 /// <returns>
 /// True if the entities are found, otherwise false
 /// </returns>
 public bool ContainsKeys(IEnumerable<Guid> keys, ExpectationMode mode = ExpectationMode.Optimistic)
 {
     var dkeys = keys.Distinct().ToArray();
     using (var db = factory.OpenDbConnection())
     {
         if (mode == ExpectationMode.Pessimistic || mode == ExpectationMode.Unknown)
             return db.Count<VCALENDAR>(q => Sql.In(q.Id, dkeys)) == dkeys.Count();
         return db.Count<VCALENDAR>(q => Sql.In(q.Id, dkeys)) != 0; 
     }
 }