Exemplo n.º 1
0
 public FrontendSession GetFrontendSession(ServerSession session)
 {
     lock (_sessions)
     {
         FrontendSession localSession = _sessions[session] as FrontendSession;
         if (localSession == null)
         {
             localSession = new FrontendSession(this, session);
             _sessions.Add(session, localSession);
         }
         return(localSession);
     }
 }
Exemplo n.º 2
0
        public override object InternalExecute(Program program, object[] arguments)
        {
            string query          = (string)arguments[0];
            string pageType       = DefaultPageType;
            string masterKeyNames = String.Empty;
            string detailKeyNames = String.Empty;
            bool   elaborate      = DefaultElaborate;

            if (arguments.Length >= 2)
            {
                if (Operator.Operands[1].DataType.Equals(program.DataTypes.SystemString))
                {
                    pageType = (string)arguments[1];
                    if (arguments.Length == 3)
                    {
                        elaborate = (bool)arguments[2];
                    }
                    else if (arguments.Length >= 4)
                    {
                        masterKeyNames = (string)arguments[2];
                        detailKeyNames = (string)arguments[3];
                        if (arguments.Length == 5)
                        {
                            elaborate = (bool)arguments[4];
                        }
                    }
                }
                else
                {
                    elaborate = (bool)arguments[1];
                }
            }
            FrontendServer  server  = FrontendServer.GetFrontendServer(program.ServerProcess.ServerSession.Server);
            FrontendSession session = server.GetFrontendSession(program.ServerProcess.ServerSession);
            DerivationSeed  seed    = new DerivationSeed(pageType, query, elaborate, masterKeyNames, detailKeyNames);

            XmlDocument document;

            if (session.UseDerivationCache)
            {
                lock (session.DerivationCache)
                {
                    session.EnsureDerivationCacheConsistent();
                    DerivationCacheItem item;
                    if (!session.DerivationCache.TryGetValue(seed, out item))
                    {
                        document = BuildInterface(program, seed);
                        session.DerivationCache.Add(seed, new DerivationCacheItem(document));
                    }
                    else
                    {
                        document = item.Document;
                    }
                }
            }
            else
            {
                document = BuildInterface(program, seed);
            }

            return(document.OuterXml);
        }