Esempio n. 1
0
 /// <summary>
 /// Initialization routine called to allow the principal object to cache and retrieve the internal UserData object
 /// </summary>
 public void Initialize()
 {
     string sUserName = this.Identity.Name;
     if (string.IsNullOrEmpty(sUserName))
         sUserName = ANONYMOUS_USER_NAME;
     if (UserDataCache.Contains(sUserName))
     {
         Debugger.OutputDebugString("UserPrincipal::Initialize. Get UserData [{0}] from cache.", sUserName);
         m_oUserData = UserDataCache.GetUserData(sUserName);
         if (m_oUserData.IsExpireFromCache())
         {
             Debugger.OutputDebugString("UserData is expired. Reload from database again.", sUserName);
             m_oUserData.Initialize(sUserName);
             UserDataCache.AddUserData(sUserName, m_oUserData);
         }
     }
     else
     {
         Debugger.OutputDebugString("UserPrincipal::Initialize. Create a new UserData [{0}] and add into cache.", sUserName);
         m_oUserData = new UserData(sUserName);
         UserDataCache.AddUserData(sUserName, m_oUserData);
     }
 }