Exemplo n.º 1
0
        private static void Test9()
        {
            var r0 = Role.FindByName("Stone");

            r0?.Delete();

            var r = new Role
            {
                Name = "Stone"
            };

            r.Insert();

            var r2 = Role.FindByName("Stone");

            XTrace.WriteLine("FindByName: {0}", r2.ToJson());

            r.Enable = true;
            r.Update();

            var r3 = Role.Find(Role._.Name == "STONE");

            XTrace.WriteLine("Find: {0}", r3.ToJson());

            r.Delete();

            var n = Role.FindCount();

            XTrace.WriteLine("count={0}", n);
        }
Exemplo n.º 2
0
        private static void Test9()
        {
            var cache = new SingleEntityCache <Int32, User> {
                Expire = 1
            };

            // 首次访问
            var user = cache[1];

            XTrace.WriteLine("cache.Success={0}", cache.Success);

            user = cache[1];
            XTrace.WriteLine("cache.Success={0}", cache.Success);

            user = cache[1];
            XTrace.WriteLine("cache.Success={0}", cache.Success);

            EntityFactory.InitAll();

            XTrace.WriteLine("TestRole");
            var r0 = Role.FindByName("Stone");

            r0?.Delete();

            var r = new Role
            {
                Name = "Stone"
            };

            r.Insert();

            var r2 = Role.FindByName("Stone");

            XTrace.WriteLine("FindByName: {0}", r2.ToJson());

            r.Enable = true;
            r.Update();

            var r3 = Role.Find(Role._.Name == "STONE");

            XTrace.WriteLine("Find: {0}", r3.ToJson());

            r.Delete();

            var n = Role.FindCount();

            XTrace.WriteLine("count={0}", n);
        }