Example #1
0
        public void SetUpFixture()
        {
            FServerConfigurationManager = new SQLCEServerConfigurationManager();
            FConfiguration = FServerConfigurationManager.GetTestConfiguration("TestInstance");
            FServerConfigurationManager.ResetInstance();
            FServer = FServerConfigurationManager.GetServer();
            FServer.Start();

            IServerSession LSession = FServer.Connect(new SessionInfo("Admin", ""));

            try
            {
                IServerProcess LProcess = LSession.StartProcess(new ProcessInfo(LSession.SessionInfo));
                try
                {
                    LProcess.ExecuteScript("EnsureLibraryRegistered('Frontend');");
                    LProcess.ExecuteScript("EnsureLibraryRegistered('TestFramework.Coverage.Base');");
                }
                finally
                {
                    LSession.StopProcess(LProcess);
                }
            }
            finally
            {
                FServer.Disconnect(LSession);
            }
        }
Example #2
0
        /// <summary> Executes a D4 script. </summary>
        public static void ExecuteScript(string script, IServer server, SessionInfo sessionInfo)
        {
            IServerSession session = server.Connect(sessionInfo);

            try
            {
                IServerProcess process = session.StartProcess(new ProcessInfo(sessionInfo));
                try
                {
                    IServerScript localScript = process.PrepareScript(script);
                    try
                    {
                        localScript.Execute(null);
                    }
                    finally
                    {
                        process.UnprepareScript(localScript);
                    }
                }
                finally
                {
                    session.StopProcess(process);
                }
            }
            finally
            {
                server.Disconnect(session);
            }
        }
        public static void ExecuteScript(IServerSession session, string script, ScriptExecuteOption options, out ErrorList errors, out TimeSpan timeElapsed, ReportScriptProgressHandler reportScriptProgress, DebugLocator locator)
        {
            IServerProcess process = session.StartProcess(new ProcessInfo(session.SessionInfo));

            try
            {
                ExecuteScript(process, script, options, out errors, out timeElapsed, reportScriptProgress, locator);
            }
            finally
            {
                session.StopProcess(process);
            }
        }
Example #4
0
        private void AsyncStop(int processID, IServerSession session)
        {
            IServerProcess process = session.StartProcess(new ProcessInfo(_session.SessionInfo));

            try
            {
                process.Execute("StopProcess(" + processID + ")", null);
            }
            finally
            {
                session.StopProcess(process);
            }
        }
Example #5
0
        public void TearDown()
        {
            if (FProcess != null)
            {
                FSession.StopProcess(FProcess);
                FProcess = null;
            }

            if (FSession != null)
            {
                FServer.Disconnect(FSession);
                FSession = null;
            }
        }
Example #6
0
 private void CleanupProcess()
 {
     if (_process != null)
     {
         try
         {
             _session.StopProcess(_process);
         }
         catch
         {
             // Don't rethrow, the session may have already been stopped
         }
         _process   = null;
         _processID = 0;
     }
 }
Example #7
0
        protected virtual void Session_End(Object sender, EventArgs e)
        {
            IServer LServer = (IServer)Session["DataServer"];

            if (LServer != null)
            {
                IServerSession LServerSession = (IServerSession)Session["DataServerSession"];
                LServerSession.StopProcess((IServerProcess)Session["DataServerProcess"]);
                LServer.Disconnect(LServerSession);
                ServerFactory.Disconnect(LServer);
            }

            if (Session["DerivationCacheWatcher"] != null)
            {
                ((FileSystemWatcher)Session["DerivationCacheWatcher"]).Dispose();
            }

            Session.Clear();
        }
Example #8
0
 public override void Close()
 {
     if (_server != null)
     {
         if (_foreignServer)
         {
             try
             {
                 OnBeforeClose();
             }
             finally
             {
                 _session       = null;
                 _server        = null;
                 _serverProcess = null;
             }
             OnAfterClose();
         }
         else
         {
             try
             {
                 try
                 {
                     try
                     {
                         try
                         {
                             try
                             {
                                 OnBeforeClose();
                             }
                             finally
                             {
                                 if (_serverProcess != null)
                                 {
                                     _session.StopProcess(_serverProcess);
                                 }
                             }
                         }
                         finally
                         {
                             _serverProcess = null;
                             if (_session != null)
                             {
                                 _server.Disconnect(_session);
                             }
                         }
                     }
                     finally
                     {
                         _session = null;
                         //DAE.Server.ServerFactory.Disconnect(FServer);
                     }
                 }
                 finally
                 {
                     _server = null;
                     if (_connection != null)
                     {
                         _connection.Dispose();
                     }
                 }
             }
             finally
             {
                 _connection = null;
             }
             OnAfterClose();
         }
     }
 }