Esempio n. 1
0
        private static void UsingIRedisTypedClient(RedisClient client)
        {
            var redisTodos = client.As<Todo>();

            //Mark all Todos, that have passed deadline, as DONE

            redisTodos.GetAll()
                      .Where(t => t.Deadline >= DateTime.Now)
                      //Extension method to execute a lambda expression for each element of a IEnumerable<T> 
                      .ForEach(t => t.IsDone = true);

            var todo = new Todo()
            {
                Id = redisTodos.GetNextSequence(),
                Text = "Todo created at " + DateTime.Now,
                Deadline = DateTime.Now.AddDays(1),
                IsDone = false,
                AssignedTo = new User()
                {
                    Name = "Doncho"
                }
            };

            redisTodos.Store(todo);
            redisTodos.GetAll()
                      .Print();
        }
Esempio n. 2
0
 private void btnBorrar_Click(object sender, EventArgs e)
 {
     try
     {
         if (MetroFramework.MetroMessageBox.Show(this, "Estas seguro de que vas a borrar el " +
                                                 "registro!", "Mensaje", MessageBoxButtons.YesNo, MessageBoxIcon.Question) ==
             DialogResult.Yes)
         {
             Empleado em = empleadoBindingSource.Current as Empleado;
             if (em != null)
             {
                 using (RedisClient cliente = new RedisClient("192.168.99.100", 6379))
                 {
                     IRedisTypedClient <Empleado> empleado = cliente.As <Empleado>();
                     empleado.DeleteById(em.ID);
                     empleadoBindingSource.RemoveCurrent();
                     Limpiar();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public void Set <T>(string key, T value, TimeSpan timeout)
 {
     using (RedisClient client = new RedisClient(_endPoint))
     {
         client.As <T>().SetValue(key, value, timeout);
     }
 }
Esempio n. 4
0
        static void Main(string[] args)
        {
            var lastId = 0L;

            using (IRedisClient client = new RedisClient("redis://192.241.154.174:6379"))
            {
                var customerClient = client.As <Customer>();
                var customer       = new Customer
                {
                    Id      = customerClient.GetNextSequence(),
                    Address = "123 Main Street",
                    Name    = "Bob Green",
                    Orders  = new List <Order>
                    {
                        new Order {
                            OrderNumber = "AB123"
                        },
                        new Order {
                            OrderNumber = "AB124"
                        }
                    }
                };

                var storedCustomer = customerClient.Store(customer);
                lastId = storedCustomer.Id;
            }

            using (IRedisClient client = new RedisClient("redis://192.241.154.174:6379"))
            {
                var customerClient = client.As <Customer>();
                var customer       = customerClient.GetById(lastId);
                Console.WriteLine($"Got Customer {customer.Id}, with name: {customer.Name}");
            }
        }
		public virtual void OnBeforeEachTest()
		{
			if (Redis != null) Redis.Dispose();
			Redis = new RedisClient(TestConfig.SingleHost);
		    Redis.NamespacePrefix = "RedisTypedClientTests:";
			RedisTyped = Redis.As<CacheRecord>();
		}
		public virtual void OnBeforeEachTest()
		{
			if (Redis != null) Redis.Dispose();
			Redis = new RedisClient(TestConfig.SingleHost);
			Redis.FlushDb();
			RedisTyped = Redis.As<CacheRecord>();
		}
Esempio n. 7
0
        public void Working_with_int_values()
        {
            const string intKey   = "intkey";
            const int    intValue = 1;

            //STORING AN INT USING THE BASIC CLIENT
            using (var redisClient = new RedisClient(TestConfig.SingleHost))
            {
                redisClient.SetValue(intKey, intValue.ToString());
                string strGetIntValue = redisClient.GetValue(intKey);
                int    toIntValue     = int.Parse(strGetIntValue);

                Assert.That(toIntValue, Is.EqualTo(intValue));
            }

            //STORING AN INT USING THE GENERIC CLIENT
            using (var redisClient = new RedisClient(TestConfig.SingleHost))
            {
                //Create a generic client that treats all values as ints:
                IRedisTypedClient <int> intRedis = redisClient.As <int>();

                intRedis.SetValue(intKey, intValue);
                var toIntValue = intRedis.GetValue(intKey);

                Assert.That(toIntValue, Is.EqualTo(intValue));
            }
        }
Esempio n. 8
0
 public void storeInCache(Hashtable table, int id)
 {
     //IDatabase db = redis.GetDatabase();
     using (RedisClient redisClient = new RedisClient(host))
     {
         IRedisTypedClient <CpuUsage> processes = redisClient.As <CpuUsage>();
         CpuUsage process = new CpuUsage
         {
             id      = id,
             process = new ProcessArrayList
             {
                 process = table
             }
         };
         processes.SetEntry(id.ToString(), process);
         redisClient.Expire(id.ToString(), 120);
     }
     //CpuUsage process = new CpuUsage
     //{
     //    id = id,
     //    process = new ProcessArrayList
     //    {
     //        process = table
     //    }
     //};
     ////Store the processes and set expiry time
     //string value = JsonConvert.SerializeObject(process);
     //db.StringSet(id.ToString(), value);
     //db.KeyExpire(id.ToString(), DateTime.Now.AddMinutes(2));
 }
Esempio n. 9
0
        private void saveScreen()
        {
            Rectangle bounds = Screen.GetBounds(Point.Empty);

            using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
            {
                using (Graphics g = Graphics.FromImage(bitmap))
                {
                    g.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size);
                }
                //var fileLocation = string.Format(@"D:\tmp\src\screen_{0}.jpg", DateTime.Now.ToString("yyyyMMddHHssfff"));
                //bitmap.Save(fileLocation, ImageFormat.Jpeg);
                //File.WriteAllText(fileLocation.Replace(".jpg", ".txt"), Constant.PointToString(Constant.GetCursorPosition()));

                using (IRedisClient client = new RedisClient())
                {
                    //IRedisTypedClient
                    var customerClient = client.As <Customer>();

                    var customer = new Customer()
                    {
                        Id    = Constant.lastCustomerId,
                        Data  = getBase64(bitmap),
                        Point = Constant.PointToString(Constant.GetCursorPosition())
                    };

                    var savedCustomer = customerClient.Store(customer);
                    Debug.WriteLine("Mesaj id : {0}", Constant.lastCustomerId);
                }
            }
        }
Esempio n. 10
0
        public void SaveItem(Item item)
        {
            var conf = new RedisEndpoint()
            {
                Host = "xxxxxxxxxxxxxx.redis.cache.windows.net", Password = "******", Ssl = true, Port = 6380
            };

            using (IRedisClient client = new RedisClient(conf))
            {
                var itemClient = client.As <Item>();
                var itemList   = itemClient.Lists["urn:item:" + item.ProductID];
                item.Id = itemClient.GetNextSequence();
                itemList.Add(item);

                client.AddItemToSortedSet("urn:Rank", item.Name, item.Price);

                //Publis top 5 Ranked Items
                IDictionary <string, double> Data = client.GetRangeWithScoresFromSortedSet("urn:Rank", 0, 4);
                List <Item> RankList = new List <Item>();
                int         counter  = 0;
                foreach (var itm in Data)
                {
                    counter++;
                    RankList.Add(new Item()
                    {
                        Name = itm.Key, Price = (int)itm.Value, Id = counter
                    });
                }

                var itemJson = JsonConvert.SerializeObject(RankList);
                client.PublishMessage("Rank", itemJson);
                //---------------------------------------------
            }
        }
Esempio n. 11
0
        public ActionResult Save(string userName, int goal, long?userId)
        {
            using (IRedisClient client = new RedisClient())
            {
                var userClient = client.As <User>();

                User user;
                if (userId != null)
                {
                    user = userClient.GetById(userId);
                    client.RemoveItemFromSortedSet("urn:leaderboard", user.Name);
                }
                else
                {
                    user = new User
                    {
                        Id = userClient.GetNextSequence()
                    };
                }
                user.Name = userName;
                user.Goal = goal;
                userClient.Store(user);
                userId = user.Id; //In case we are creating a new user
                client.AddItemToSortedSet("urn:leaderboard", user.Name, user.Total);
            }
            return(RedirectToAction("Index", "Tracker", new { userId }));
        }
        public void Working_with_int_values()
        {
            const string intKey = "intkey";
            const int intValue = 1;

            //STORING AN INT USING THE BASIC CLIENT
            using (var redisClient = new RedisClient(TestConfig.SingleHost))
            {
                redisClient.SetEntry(intKey, intValue.ToString());
                string strGetIntValue = redisClient.GetValue(intKey);
                int toIntValue = int.Parse(strGetIntValue);

                Assert.That(toIntValue, Is.EqualTo(intValue));
            }

            //STORING AN INT USING THE GENERIC CLIENT
            using (var redisClient = new RedisClient(TestConfig.SingleHost))
            {
                //Create a generic client that treats all values as ints:
                IRedisTypedClient<int> intRedis = redisClient.As<int>();

                intRedis.SetEntry(intKey, intValue);
                var toIntValue = intRedis.GetValue(intKey);

                Assert.That(toIntValue, Is.EqualTo(intValue));
            }
        }
Esempio n. 13
0
        public ActionResult Save(string userName, int goal, long?userId)
        {
            using (IRedisClient client = new RedisClient(new RedisEndpoint {
                Host = "117.20.40.28", Port = 6379, Password = "******"
            }))
            {
                var  userClient = client.As <User>();
                User user;

                if (userId != null)
                {
                    user = userClient.GetById(userId);
                    client.RemoveItemFromSortedSet("urn:leaderboard", user.Name);
                }
                else
                {
                    user = new User
                    {
                        Id = userClient.GetNextSequence()
                    };
                }

                user.Name = userName;
                user.Goal = goal;
                userClient.Store(user);
                userId = user.Id;
                client.AddItemToSortedSet("urn:leaderboard", user.Name, user.Total);
            }

            return(RedirectToAction("Index", "Tracker", new { userId }));
        }
        public void Can_Retrieve_DomainEvents()
        {
            var userId = Guid.NewGuid();
            var client = new RedisClient(TestConfig.SingleHost);
            client.FlushAll();

            client.As<DomainEvent>().Lists["urn:domainevents-" + userId].Add(new UserPromotedEvent { UserId = userId });


            var users = client.As<DomainEvent>().Lists["urn:domainevents-" + userId];

            Assert.That(users.Count, Is.EqualTo(1));

            var userPromoEvent = (UserPromotedEvent)users[0];
            Assert.That(userPromoEvent.UserId, Is.EqualTo(userId));
        }
Esempio n. 15
0
        //[HttpPost]
        public ActionResult CreateFromId(string isbn)
        {
            string fullUri = getBookInfoUri + isbn;

            HttpWebRequest  webRequest   = GetWebRequest(fullUri);
            HttpWebResponse response     = (HttpWebResponse)webRequest.GetResponse();
            string          jsonResponse = string.Empty;

            using (StreamReader sr = new StreamReader(response.GetResponseStream()))
            {
                jsonResponse = sr.ReadToEnd();
            }

            JObject o = JObject.Parse(jsonResponse);


            Book newBook = new Book();

            newBook.Id        = long.Parse(isbn);
            newBook.BookName  = (string)o["data"][0]["title"];
            newBook.Author    = (string)o["data"][0]["author_data"][0]["name"];
            newBook.Edition   = (string)o["data"][0]["edition_info"];
            newBook.Publisher = (string)o["data"][0]["publisher_text"];
            newBook.Summary   = (string)o["data"][0]["summary"];

            using (var redisClient = new RedisClient())
            {
                var redisUsers = redisClient.As <Book>();
                ViewBag.pageOfBooks = redisUsers.GetAll();
                return(View());
            }

            return(View("Index"));
        }
     public FullEmployee Map(Employee source)
     {
         FullEmployee employee = new FullEmployee()
         {
             Id = source.Id,
             Age = source.Age,
             BirthDate = source.BirthDate,
             Name = source.Name
         };
 
         var mapper = new FullRoleMapper();
         var client = new RedisClient("localhost");
 
         employee.Roles = _roles.Where(r => source.Roles.Contains(r.Id)).ToList();
         if (employee.Roles.Count != source.Roles.Count)
         {
             var newRoles = client
                 .As<Role>()
                 .GetByIds(source.Roles.Except(employee.Roles.Select(r => r.Id)))
                 .Select(r => mapper.Map(r)))
                 .ToList();
             employee.Roles.AddRange(newRoles);
             _roles.AddRange(newRoles);
         }
         return employee;
     }
Esempio n. 17
0
        public List <TickDTO> GetTickRaw(int securityId, int count = 200)
        {
            List <Tick> ticks;

            using (var redisTypedClient = RedisClient.As <Tick>())
            {
                var list = redisTypedClient.Lists[Ticks.GetTickListNamePrefix(TickSize.Raw) + securityId];
                //ticks = list.GetAll();
                var listSize = list.Count;
                ticks = list.GetRange(listSize - count, listSize);
            }

            List <TickDTO> result;

            if (ticks.Count == 0)
            {
                result = new List <TickDTO>();
            }
            else
            {
                //var lastTickTime = ticks.Last().T;
                //result = ticks.Where(o => lastTickTime - o.T <= TimeSpan.FromMinutes(30)).Select(o => Mapper.Map<TickDTO>(o)).ToList();

                result = ticks.Select(o => Mapper.Map <TickDTO>(o)).ToList();
            }

            return(result);
        }
        public override bool ValidateUser(string username, string password)
        {
            using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
            {
                var client = rClient.As <RedisMember>();
                var rm     = client.GetAll().SingleOrDefault(m => m.UserName.ToLower() == username.ToLower());

                if (rm == null || !(rm.IsApproved && !rm.IsLockedOut))
                {
                    return(false);
                }

                byte[] salt = rm.PassSalt;
                byte[] hash = calculateHash(password, ref salt);

                bool isFail = false;

                for (int i = 0; i > hash.Length; i++)
                {
                    isFail |= (hash[i] != rm.PassHash[i]);
                }

                if (isFail)
                {
                    if (rm.LockoutWindowStart == DateTime.MinValue)
                    {
                        rm.LockoutWindowStart    = DateTime.Now;
                        rm.LockoutWindowAttempts = 1;
                    }
                    else
                    {
                        if (rm.LockoutWindowStart.AddMinutes(PasswordAttemptWindow) > DateTime.Now)
                        {
                            // still within window
                            rm.LockoutWindowAttempts++;
                            if (rm.LockoutWindowAttempts >= MaxInvalidPasswordAttempts)
                            {
                                rm.IsLockedOut = true;
                            }
                        }
                        else
                        {
                            // outside of window, reset
                            rm.LockoutWindowStart    = DateTime.Now;
                            rm.LockoutWindowAttempts = 1;
                        }
                    }
                }
                else
                {
                    rm.LastLoginDate         = DateTime.Now;
                    rm.LockoutWindowStart    = DateTime.MinValue;
                    rm.LockoutWindowAttempts = 0;
                }
                client.Store(rm);

                return(!isFail);
            }
        }
Esempio n. 19
0
 /// <summary>
 /// To validates the user with username and password
 /// </summary>
 /// <param name="userName">user's username</param>
 /// <param name="userId">user's password</param>
 /// <returns>User object for the requested userId</returns>
 public User ValidateUser(string userName, string password)
 {
     using (var redisClient = new RedisClient(AppSettings.RedisServer))
     {
         return(redisClient.As <User>().GetAll().ToList().
                Where(x => x.UserName == userName && x.Password == password).SingleOrDefault());
     }
 }
Esempio n. 20
0
 /// <summary>
 /// To check is user already exists
 /// </summary>
 /// <param name="userName">user's username</param>
 /// <returns>user existance (either yes or no)</returns>
 public bool IsUserExists(string userName)
 {
     using (var redisClient = new RedisClient(AppSettings.RedisServer))
     {
         return(redisClient.As <User>().GetAll().ToList().
                Any <User>(x => x.UserName == userName));
     }
 }
Esempio n. 21
0
 public void DeletePlayer(int id)
 {
     using (IRedisClient client = new RedisClient(host, port, pw))
     {
         var playerClient = client.As <Player>();
         playerClient.DeleteById(id);
     }
 }
Esempio n. 22
0
 public UserManipulate()
 {
     if (!CheckNextGlobalCounterUserIdExist())
     {
         var redisCounterSetup = redis.As <string>();
         redisCounterSetup.SetEntry(globalCounterUserId, "0");
     }//provera da li vec postoji brojac za user-a (ako ne postoji postavlja se novi na 0)
 }
Esempio n. 23
0
 private void Form1_Load(object sender, EventArgs e)
 {
     using (RedisClient client = new RedisClient("localhost", 6379)) {
         IRedisTypedClient <Phone> phone = client.As <Phone>();
         phoneBindingSource.DataSource = phone.GetAll();
         Edit(true);//Read only
     }
 }
Esempio n. 24
0
 public void DeleteAllPlayers()
 {
     using (IRedisClient client = new RedisClient(host, port, pw))
     {
         var playerClient = client.As <Player>();
         playerClient.DeleteAll();
     }
 }
Esempio n. 25
0
 /// <summary>
 /// store 泛型值
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 public static void StroteEntity <T>(T value)
 {
     using (var client = new RedisClient(Host))
     {
         var entity = client.As <T>();
         entity.Store(value);
     }
 }
 public static ServerMappingEntry GetEntryById(long id)
 {
     using (var RedisConnection = new RedisClient(EnvVar.AsString("Redis_Hostname"), EnvVar.AsInt("Redis_Port")))
     {
         var ListServerMappingEntry = RedisConnection.As <ServerMappingEntry>();
         return(ListServerMappingEntry.GetById(id));
     }
 }
Esempio n. 27
0
 /// <summary>
 /// 获得泛型类型T的所有值
 /// </summary>
 /// <returns></returns>
 public static List <T> GetEntitys <T>()
 {
     using (var client = new RedisClient(Host))
     {
         var entity = client.As <T>();
         return(entity.GetAll().ToList());
     }
 }
Esempio n. 28
0
 /// <summary>
 /// 搜索实体
 /// </summary>
 /// <param name=""></param>
 /// <param name="DoSearch"></param>
 /// <returns></returns>
 public static IEnumerable <T> SearchEntitys <T>(Func <T, bool> DoSearch)
 {
     using (var client = new RedisClient(Host))
     {
         var entity = client.As <T>();
         return(entity.GetAll().Where(DoSearch));
     }
 }
 public static IList <ServerMappingEntry> GetAll()
 {
     using (var RedisConnection = new RedisClient(EnvVar.AsString("Redis_Hostname"), EnvVar.AsInt("Redis_Port")))
     {
         var ListServerMappingEntry = RedisConnection.As <ServerMappingEntry>();
         return(ListServerMappingEntry.GetAll());
     }
 }
Esempio n. 30
0
 /// <summary>
 /// store泛型类型列表
 /// </summary>
 /// <param name="vals"></param>
 /// <returns></returns>
 public static void StoreEntity <T>(List <T> vals)
 {
     using (var client = new RedisClient(Host))
     {
         var entity = client.As <T>();
         entity.StoreAll(vals);
     }
 }
Esempio n. 31
0
 /// <summary>
 /// 获得泛型类型的下一个序列
 /// </summary>
 /// <returns></returns>
 public static long GetNextSequence <T>()
 {
     using (var client = new RedisClient(Host))
     {
         var entity = client.As <T>();
         return(entity.GetNextSequence());
     }
 }
Esempio n. 32
0
 public static IEnumerable <MetaItem> Select()
 {
     using (RedisClient rClient = new RedisClient("localhost", 6379, db: 1))
     {
         var client = rClient.As <MetaItem>();
         return(client.GetAll());
     }
 }
Esempio n. 33
0
 public void DeleteByKey(long key)
 {
     using (IRedisClient client = new RedisClient())
     {
         var genericClient = client.As <T>();
         genericClient.DeleteById(key);
     }
 }
Esempio n. 34
0
 /// <summary>
 /// 通过Id搜索
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public static T SearchEneitys <T>(long id)
 {
     using (var client = new RedisClient(Host))
     {
         var entity = client.As <T>();
         return(entity.GetById(id));
     }
 }
        public void Throws_on_access_of_21_types()
        {
            using (var client = new RedisClient(TestConfig.SingleHost))
            {
                Access20Types();
                Access20Types();

                Assert.Throws<LicenseException>(() =>
                    client.As<T21>());
            }
        }
Esempio n. 36
0
        public void Allows_access_of_more_than_21_types()
        {
            using (var client = new RedisClient(TestConfig.SingleHost))
            {
                Access20Types();
                Access20Types();

                client.As<T21>();
                Assert.Pass();

                client.As<T22>();
                Assert.Pass();

                client.As<T23>();
                Assert.Pass();

                client.As<T24>();
                Assert.Pass();
            }
        }
Esempio n. 37
0
 public TransportMessage Receive()
 {
     using (var redisClient = new RedisClient())
     {
        
             var redis = redisClient.As<TransportMessage>();
             var message = redis.GetValue(string.Format("{0}:{1}", _address.Machine, _address.Queue));
             return message;
         
     }
 }
        public void Allows_access_of_21_types()
        {
            Licensing.RegisterLicense(new AppSettings().GetString("servicestack:license"));

            using (var client = new RedisClient(TestConfig.SingleHost))
            {
                Access20Types();
                Access20Types();

                client.As<T21>();
            }
        }
        public void SetUp()
        {
            if (client != null)
            {
                client.Dispose();
                client = null;
            }
            client = new RedisClient(TestConfig.SingleHost);
            client.FlushAll();

            redis = client.As<CustomType>();

            List = redis.Lists[ListId];
            List2 = redis.Lists[ListId2];
        }
        public void Can_from_Retrieve_DomainEvents_list()
        {
            var client = new RedisClient(TestConfig.SingleHost);
            var users = client.As<AggregateEvents>();

            var userId = Guid.NewGuid();

            var eventsForUser = new AggregateEvents
            {
                Id = userId,
                Events = new List<DomainEvent>()
            };

            eventsForUser.Events.Add(new UserPromotedEvent { UserId = userId });

            users.Store(eventsForUser);

            var all = users.GetAll(); 
        }
        public void Working_with_int_list_values()
        {
            const string intListKey = "intListKey";
            var intValues = new List<int> { 2, 4, 6, 8 };

            //STORING INTS INTO A LIST USING THE BASIC CLIENT
            using (var redisClient = new RedisClient(TestConfig.SingleHost))
            {
                IList<string> strList = redisClient.Lists[intListKey];

                //storing all int values in the redis list 'intListKey' as strings
                intValues.ForEach(x => strList.Add(x.ToString()));

                //retrieve all values again as strings
                List<string> strListValues = strList.ToList();

                //convert back to list of ints
                List<int> toIntValues = strListValues.ConvertAll(x => int.Parse(x));

                Assert.That(toIntValues, Is.EqualTo(intValues));

                //delete all items in the list
                strList.Clear();
            }

            //STORING INTS INTO A LIST USING THE GENERIC CLIENT
            using (var redisClient = new RedisClient(TestConfig.SingleHost))
            {
                //Create a generic client that treats all values as ints:
                IRedisTypedClient<int> intRedis = redisClient.As<int>();

                IRedisList<int> intList = intRedis.Lists[intListKey];

                //storing all int values in the redis list 'intListKey' as ints
                intValues.ForEach(x => intList.Add(x));

                List<int> toIntListValues = intList.ToList();

                Assert.That(toIntListValues, Is.EqualTo(intValues));
            }
        }
Esempio n. 42
0
 protected void Access20Types()
 {
     using (var client = new RedisClient(TestConfig.SingleHost))
     {
         client.As<T01>();
         client.As<T02>();
         client.As<T03>();
         client.As<T04>();
         client.As<T05>();
         client.As<T06>();
         client.As<T07>();
         client.As<T08>();
         client.As<T09>();
         client.As<T10>();
         client.As<T11>();
         client.As<T12>();
         client.As<T13>();
         client.As<T14>();
         client.As<T15>();
         client.As<T16>();
         client.As<T17>();
         client.As<T18>();
         client.As<T19>();
         client.As<T20>();
     }
 }
        public void Working_with_Generic_types()
        {
            using (var redisClient = new RedisClient(TestConfig.SingleHost))
            {
                //Create a typed Redis client that treats all values as IntAndString:
                var typedRedis = redisClient.As<IntAndString>();

                var pocoValue = new IntAndString { Id = 1, Letter = "A" };
                typedRedis.SetEntry("pocoKey", pocoValue);
                IntAndString toPocoValue = typedRedis.GetValue("pocoKey");

                Assert.That(toPocoValue.Id, Is.EqualTo(pocoValue.Id));
                Assert.That(toPocoValue.Letter, Is.EqualTo(pocoValue.Letter));

                var pocoListValues = new List<IntAndString> {
                    new IntAndString {Id = 2, Letter = "B"},
                    new IntAndString {Id = 3, Letter = "C"},
                    new IntAndString {Id = 4, Letter = "D"},
                    new IntAndString {Id = 5, Letter = "E"},
                };

                IRedisList<IntAndString> pocoList = typedRedis.Lists["pocoListKey"];

                //Adding all IntAndString objects into the redis list 'pocoListKey'
                pocoListValues.ForEach(x => pocoList.Add(x));

                List<IntAndString> toPocoListValues = pocoList.ToList();

                for (var i = 0; i < pocoListValues.Count; i++)
                {
                    pocoValue = pocoListValues[i];
                    toPocoValue = toPocoListValues[i];
                    Assert.That(toPocoValue.Id, Is.EqualTo(pocoValue.Id));
                    Assert.That(toPocoValue.Letter, Is.EqualTo(pocoValue.Letter));
                }
            }
        }
        public void Allows_access_of_21_types()
        {
#if NETCORE
            Environment.GetEnvironmentVariable("SERVICESTACK_LICENSE");
#else
            Licensing.RegisterLicense(new AppSettings().GetString("servicestack:license"));
#endif

            using (var client = new RedisClient(TestConfig.SingleHost))
            {
                Access20Types();
                Access20Types();

                client.As<T21>();
            }
        }