Exemplo n.º 1
0
 /// <summary>
 /// 根据Ids删除
 /// 2016-03-28 23:48:18
 /// </summary>
 /// <param name="ids"></param>
 /// <typeparam name="T"></typeparam>
 public void DeleteByIds <T>(IList <int> ids)
 {
     using (IRedisClient client = RedisManager.GetRedisWriteClient())
     {
         IRedisTypedClient <T> typedClient = client.As <T>();
         typedClient.DeleteByIds(ids);
     }
 }
Exemplo n.º 2
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (MetroFramework.MetroMessageBox.Show(this, "Are you sure want to delete this record?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         Phone p = phoneBindingSource.Current as Phone;
         if (p != null)
         {
             using (RedisClient client = new RedisClient("localhost", 6379))
             {
                 IRedisTypedClient <Phone> phone = client.As <Phone>();
                 phone.DeleteByIds(p.ID);
                 phoneBindingSource.RemoveCurrent();
                 ClearText();
             }
         }
     }
 }
        public void Can_Delete_ModelWithIdAndName()
        {
            var tos = Factory.CreateList();
            var ids = tos.ConvertAll(x => x.GetId().ToString());

            redis.StoreAll(tos);

            var deleteIds = new[] { ids[1], ids[3] };

            redis.DeleteByIds(deleteIds);

            var froms   = redis.GetByIds(ids);
            var fromIds = froms.Map(x => x.GetId().ToString());

            var expectedIds = ids.Where(x => !deleteIds.Contains(x))
                              .ToList().ConvertAll(x => x.ToString());

            Assert.That(fromIds, Is.EquivalentTo(expectedIds));
        }
Exemplo n.º 4
0
 public void DeleteByIds(IEnumerable ids)
 {
     redisTypedClient.DeleteByIds(ids);
 }