Beispiel #1
0
 public bool ShareTo <T>(TypedHashtable target, string sourceKey = null, string targetKey = null)
 {
     if (!Contains <T>(sourceKey))
     {
         return(false);
     }
     target.Add <T>(Get <T>(sourceKey), targetKey);
     return(true);
 }
Beispiel #2
0
        public HttpSessionStateWrapper(
            HttpSessionState sessionState, DateTime currentTime)
        {
            _SessionState = sessionState;
            _SessionId    = sessionState.SessionID;
            _CurrentTime  = currentTime;
            _Settings     = HttpContext.Current.Profile as PersonalSettings; // 获得Profile对象

            // TicketedObjectManager

            string key = D.Session.Keys.TicketObjectManager;

            _TKObjectManager = Get <TicketedObjectManager>(key);
            if (_TKObjectManager == null)
            {
                _TKObjectManager = new TicketedObjectManager();
                Set <TicketedObjectManager>(_TKObjectManager, key);
            }
            _TKObjectManager.Pulse();

            // ExtraThread

            key          = D.Session.Keys.ExtraThread;
            _ExtraThread = Get <ExtraThreadWrapper>(key);
            if (_ExtraThread == null)
            {
                _ExtraThread = new ExtraThreadWrapper();
                Set <ExtraThreadWrapper>(_ExtraThread, key);
            }

            // Cache

            key    = D.Session.Keys.Cache;
            _Cache = Get <TypedHashtable>(key);
            if (_Cache == null)
            {
                _Cache = new TypedHashtable();
                Set <TypedHashtable>(_Cache, key);
            }
        }