示例#1
0
 internal void setConnections(MySession session, IList <string> sites)
 {
     //Dictionary<string, AbstractConnection> cxns = new Dictionary<string, AbstractConnection>();
     foreach (string site in sites)
     {
         AbstractConnection cxn = (AbstractConnection)ConnectionPools.getInstance().checkOut(site);
         cxn.setState(session.Sessions.States[site].State as Dictionary <string, object>);
         //cxns.Add(site, cxn);
         session.ConnectionSet.Add(cxn);
     }
 }
示例#2
0
        internal void setConnection(MySession session, string sitecode)
        {
            AbstractConnection cxn = (AbstractConnection)ConnectionPools.getInstance().checkOut(sitecode);

            if (session.Sessions == null)
            {
                Dictionary <string, AbstractState> state0 = new Dictionary <string, AbstractState>();
                state0.Add(sitecode, new VistaState());
                session.Sessions = new VistaStates(state0);
            }
            if (null != session.Sessions && null != session.Sessions.States && session.Sessions.States.ContainsKey(sitecode) && null != session.Sessions.States[sitecode].State)
            {
                cxn.setState(session.Sessions.States[sitecode].State as Dictionary <string, object>);
            }
            session.ConnectionSet.Add(cxn); // only adds if not present
        }
示例#3
0
        internal void setConnection(MySession session)
        {
            if (session.ConnectionSet == null || session.ConnectionSet.BaseConnection == null)
            {
                throw new ArgumentNullException("Invalid session - need to connect?");
            }
            AbstractConnection cxn = (AbstractConnection)ConnectionPools.getInstance().checkOut(session.ConnectionSet.BaseSiteId);

            // set the state for this connection only if the state has been instantiated elsewhere
            if (null != session.Sessions && null != session.Sessions.States &&
                session.Sessions.States.ContainsKey(session.ConnectionSet.BaseSiteId) &&
                null != session.Sessions.States[session.ConnectionSet.BaseSiteId].State)
            {
                cxn.setState(session.Sessions.States[session.ConnectionSet.BaseSiteId].State as Dictionary <string, object>);
            }
        }