/// <summary> /// 返回指定用户的完整信息 /// </summary> /// <param name="uid">用户id</param> /// <returns>用户信息</returns> public static UserInfo GetUserInfo(int uid) { if (uid < 0) return null; IDataReader reader; UserInfo userInfo = null; if (appDBCache) { userInfo = IUserService.GetUserInfo(uid); if (userInfo == null) { reader = DatabaseProvider.GetInstance().GetUserInfoToReader(uid); if (reader.Read()) { userInfo = LoadSingleUserInfo(reader); reader.Close(); } if (userInfo != null)//如数据库中有数据而cache中没有则强制添加 IUserService.CreateUser(userInfo); } } else { reader = DatabaseProvider.GetInstance().GetUserInfoToReader(uid); if (reader.Read()) { userInfo = LoadSingleUserInfo(reader); reader.Close(); } } return userInfo; }