Beispiel #1
0
        static void Test3()
        {
            //foreach (var item in DAL.ConnStrs)
            //{
            //    Console.WriteLine("{0}\t{1}", item.Key, item.Value);
            //}

            //var fact = MySqlClientFactory.Instance;
            //var fact = SqliteFactory.Instance;

            //var dal = DAL.Create("Sqlite");
            //DAL.AddConnStr("Membership", "Server=.;Port=3306;Database=world;Uid=root;Pwd=root", null, "MySql");
            //var dal = DAL.Create("Membership");
            //Console.WriteLine(dal.Db.ConnectionString);

            //var ds = dal.Select("select * from city");
            //Console.WriteLine(ds.Tables[0].Rows.Count);

            var user = UserX.FindByName("admin");

            Console.WriteLine("Name:" + user.DisplayName);
            Console.WriteLine("修改DisplayName:" + user.DisplayName);
            user.DisplayName = "微信表情符😃666";
            user.Save();
            user = UserX.Find(UserX._.Name == "admin");
            Console.WriteLine("修改后的DisplayName:" + user.DisplayName);



            //var n = UserX.Meta.Count;
            //Console.WriteLine(n);
        }
Beispiel #2
0
        /// <summary>获取用户信息</summary>
        /// <param name="sso"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        public virtual IManageUser GetUser(OAuthServer sso, String token)
        {
            var username = sso.Decode(token);

            var user = Provider?.FindByName(username);

            // 两级单点登录可能因缓存造成查不到用户
            if (user == null)
            {
                user = UserX.Find(UserX._.Name == username);
            }

            return(user);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            //XTrace.UseConsole();

            //var user=new UserX()
            //{
            //     Name = "ding",
            //     Enable = true
            //};
            //user.Insert();
            //XTrace.WriteLine($"用户id{user.ID}");

            var user = UserX.Find(UserX._.Name == "ding");

            Console.WriteLine(user.Name);
            Console.ReadKey();
        }