Exemplo n.º 1
0
 private void SessionDisposed(object sender, EventArgs args)
 {
     if (_session != null)
     {
         _session.Disposed -= new EventHandler(SessionDisposed);
         _frontendServer._sessions.Remove(_session);
         _session        = null;
         _frontendServer = null;
     }
 }
Exemplo n.º 2
0
 // returns the frontend server for the given DAE instance
 public static FrontendServer GetFrontendServer(DAE.Server.Engine server)
 {
     lock (_servers)
     {
         FrontendServer localServer = _servers[server] as FrontendServer;
         if (localServer == null)
         {
             localServer = new FrontendServer(server);
             _servers.Add(server, localServer);
         }
         return(localServer);
     }
 }
Exemplo n.º 3
0
 public FrontendSession(FrontendServer frontendServer, ServerSession session)
 {
     _frontendServer    = frontendServer;
     _session           = session;
     _session.Disposed += new EventHandler(SessionDisposed);
 }
Exemplo n.º 4
0
 public override object InternalExecute(Program program, object[] arguments)
 {
     FrontendServer.GetFrontendServer(program.ServerProcess.ServerSession.Server).GetFrontendSession(program.ServerProcess.ServerSession).ClearDerivationCache();
     return(null);
 }
Exemplo n.º 5
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);
        }