C# ServiceStack.Redis 操作對象List


    class Car
    {
        public Int32 Id { get; set; } 
        public String Name { get; set; }

        static void Main(string[] args)
        {
            RedisClient client = new RedisClient("127.0.0.1", 6379);
            client.FlushAll();
            client.ChangeDb(0);
            var IRCar = client.As<Car>();
            IRCar.DeleteAll();
            var c1 = new Car() { Id = 1, Name = "東風標致408" };
            IRCar.Store(c1);
            List list = new List();
            list.Add(c1);
            var c2 = new Car() { Id = 2, Name = "東風標致508" };
            list.Add(c2);
            var c3 = new Car() { Id = 3, Name = "東風標致308" };
            list.Add(c3);
            var c4 = new Car() { Id = 4, Name = "東風標致3008" };
            list.Add(c4);
            IRCar.StoreAll(list);
            var _list = IRCar.GetAll();
        }
    }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM