Exemplo n.º 1
0
        public static void Subscriber()
        {
            var sub = _conn.GetSubscriber();

            sub.Subscribe("LogSql",
                          (channel, message) =>
            {
                try
                {
                    var info = JsonConvert.DeserializeObject <SqlLog>(message);
                    TORM.Insert(info);
                }
                catch (Exception e)
                {
                    _conn.GetDatabase().ListRightPush("Error:Subscriber:LogSql:" + DateTime.Today.ToShortDateString(), e.ToString());
                }
            });
            sub.Subscribe("ExplainErrorLog",
                          (channel, message) =>
            {
                try
                {
                    var info = JsonConvert.DeserializeObject <ExplainErrorLog>(message);
                    TORM.Insert(info);
                }
                catch (Exception e)
                {
                    _conn.GetDatabase().ListRightPush("Error:Subscriber:ExplainErrorLog:" + DateTime.Today.ToShortDateString(), e.ToString());
                }
            });
        }
Exemplo n.º 2
0
        public void InsertOneTest()
        {
            var result = TORM.Insert(new Rules
            {
                CreatedAt = DateTime.Now.AddDays(-3)
            });

            Debug.Assert(result == 1);
        }
Exemplo n.º 3
0
        public void InsertTest2()
        {
            var result = TORM.Insert(new City
            {
                Name       = "123",
                ProvinceId = 5
            });

            Debug.Assert(result == 1);
        }