Esempio n. 1
0
        public void demo_select_join()
        {
            UserInfoM tb = new UserInfoM();

            tb.innerJoin("$.user_link l").on("user_id = l.user_id")
            .where ("id=?", 22)
            .select("*");
        }
Esempio n. 2
0
        public void demo_update()
        {
            UserInfoM tb = new UserInfoM();

            tb.sex = 1;//男的

            tb.where ("id=?", 22).update();
        }
Esempio n. 3
0
        public void demo_insert()
        {
            UserInfoM tb = new UserInfoM();

            tb.userID = 12;
            tb.sex    = 1;//男的

            tb.insert();
        }
Esempio n. 4
0
        public void demo_update3()
        {
            var       data = new Dictionary <string, object>();
            UserInfoM tb   = new UserInfoM();

            tb.where ("id=?", 22).update((key) => {
                switch (key)
                {
                case "sex": return(1);

                case "name": return("cc");

                default: return(null);
                }
            });
        }
Esempio n. 5
0
        public void demo_update2()
        {
            var       data = new Dictionary <string, object>();
            UserInfoM tb   = new UserInfoM();

            tb.where ("id=?", 22).update((key) => {
                if (data.ContainsKey(key))
                {
                    return(data[key]);
                }
                else
                {
                    return(null);
                }
            });
        }
Esempio n. 6
0
        public void demo_insert2()
        {
            var data = new Dictionary <string, object>();//或其它字段类

            UserInfoM tb = new UserInfoM();

            tb.insert((key) => {
                if (data.ContainsKey(key))
                {
                    return(data[key]);
                }
                else
                {
                    return(null);
                }
            });
        }
Esempio n. 7
0
        public async Task <UserInfoM> GetUserInfo(string token)
        {
            UserInfoM result = null;

            using (var client = new HttpClient())
            {
                var discovery = await DiscoveryService.GetDiscovery();

                var response = await client.GetUserInfoAsync(new UserInfoRequest
                {
                    Address = discovery.UserinfoEndpoint,
                    Token   = token
                });

                if (response.IsError)
                {
                    throw new Exception(response.Error);
                }

                result = Mapper.Map <UserInfoM>(response);
            }

            return(result);
        }
Esempio n. 8
0
        public void demo_select()
        {
            UserInfoM tb = new UserInfoM();

            tb.where ("id=?", 22).select("*");
        }
Esempio n. 9
0
        public void demo_delete()
        {
            UserInfoM tb = new UserInfoM();

            tb.where ("id=?", 22).delete();
        }