private void SessionDisposed(object sender, EventArgs args) { if (_session != null) { _session.Disposed -= new EventHandler(SessionDisposed); _frontendServer._sessions.Remove(_session); _session = null; _frontendServer = null; } }
// 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); } }
public FrontendSession(FrontendServer frontendServer, ServerSession session) { _frontendServer = frontendServer; _session = session; _session.Disposed += new EventHandler(SessionDisposed); }
public override object InternalExecute(Program program, object[] arguments) { FrontendServer.GetFrontendServer(program.ServerProcess.ServerSession.Server).GetFrontendSession(program.ServerProcess.ServerSession).ClearDerivationCache(); return(null); }
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); }