Example #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("*");
        }
Example #2
0
        public void demo_update()
        {
            UserInfoM tb = new UserInfoM();

            tb.sex = 1;//男的

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

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

            tb.insert();
        }
Example #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);
                }
            });
        }
Example #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);
                }
            });
        }
Example #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);
                }
            });
        }
Example #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);
        }
Example #8
0
        public void demo_select()
        {
            UserInfoM tb = new UserInfoM();

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

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