Example #1
0
 public override void Open()
 {
     if (_server == null)
     {
         _foreignServer = false;
         OnBeforeOpen();
         if (_alias == null)
         {
             throw new ProviderException(ProviderException.Codes.NoAliasSpecified);
         }
         _connection = new ServerConnection(_alias, true);
         _server     = _connection.Server;
         try
         {
             _alias.SessionInfo.Environment = "ADO.NET";
             _session       = _server.Connect(_alias.SessionInfo);
             _serverProcess = _session.StartProcess(new ProcessInfo(_alias.SessionInfo));
         }
         catch
         {
             _server        = null;
             _session       = null;
             _serverProcess = null;
             _connection.Dispose();
             _connection = null;
             throw;
         }
         OnAfterOpen();
     }
 }
Example #2
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 #3
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);
            }
        }
Example #4
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (Request.Params["DataServerUri"] == null || Request.Params["LoginName"] == null || Request.Params["Password"] == null)
            {
                Response.StatusCode = (int)HttpStatusCode.ResetContent;                 // This will tell the client that it needs to log back in.
                PrintLoginForm(Context);
            }
            else
            {
                // connect to DAE server
                IServer LServer;
                try
                {
                    LServer = ServerFactory.Connect(Request.Params["DataServerUri"]);
                }
                catch (Exception LException)
                {
                    throw new ServerException(ServerException.Codes.DatabaseUnreachable, LException);
                }
                Session.Add("DataServer", LServer);

                SessionInfo LSessionInfo = new SessionInfo(Request.Params["LoginName"], Request.Params["Password"]);
                Session.Add("DataSessionInfo", LSessionInfo);

                IServerSession LSession = LServer.Connect(LSessionInfo);
                Session.Add("DataServerSession", LSession);
                Session.Add("DataServerProcess", LSession.StartProcess());

                Session.Add("UseDerivationCache", Request.Params["UseDerivationCache"] == null ? true : Boolean.Parse(Request.Params["UseDerivationCache"]));
                Session.Add("DerivationCache", new Hashtable());
                Session.Add("DerivationTimeStamp", LServer.DerivationTimeStamp);

                // Monitor the App directory for changes
                FileSystemWatcher LWatcher = new FileSystemWatcher(Context.Request.PhysicalApplicationPath);
                LWatcher.NotifyFilter          = NotifyFilters.LastWrite | NotifyFilters.FileName;
                LWatcher.IncludeSubdirectories = true;
                LWatcher.Changed += new FileSystemEventHandler(ClearDerivationCache);
                LWatcher.Renamed += new RenamedEventHandler(ClearDerivationCacheDueToRename);
                LWatcher.Deleted += new FileSystemEventHandler(ClearDerivationCache);
                Session.Add("DerivationCacheWatcher", LWatcher);
                LWatcher.EnableRaisingEvents = true;

                Response.SetCookie(new HttpCookie("LastDataServerUri", Request.Params["DataServerUri"]));
                Response.SetCookie(new HttpCookie("LastLoginName", Request.Params["LoginName"]));
                if (Request.Params["ReturnUrl"] != null)
                {
                    FormsAuthentication.RedirectFromLoginPage(Request.Params["LoginName"], false);
                }
                else
                {
                    FormsAuthentication.SetAuthCookie(Request.Params["LoginName"], false);
                    Response.Write(CLoginSuccessful);
                }
            }
        }
Example #5
0
        public Pipe(IServerSession serverSession)
        {
            _serverSession = serverSession;

            ProcessInfo processInfo = new ProcessInfo(_serverSession.SessionInfo);

            processInfo.DefaultIsolationLevel = DAE.IsolationLevel.Browse;
            _syncProcess = _serverSession.StartProcess(processInfo);

            InitializeAsync();
        }
        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 #7
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 #8
0
 public void Start()
 {
     if (!_isRunning)
     {
         CleanupProcess();
         var processInfo = new ProcessInfo(_session.SessionInfo);
         processInfo.Language = _language;
         _process             = _session.StartProcess(processInfo);
         _processID           = _process.ProcessID;
         _isRunning           = true;
         _asyncThread         = new Thread(ExecuteAsync);
         _asyncThread.Start();
     }
 }
Example #9
0
 public void SetUp()
 {
     FSession = FServer.Connect(new SessionInfo("Admin", ""));
     FProcess = FSession.StartProcess(new ProcessInfo(FSession.SessionInfo));
 }
Example #10
0
 public void SetUp()
 {
     FSession = FServer.Connect(new SessionInfo("Admin", "", "TestFramework.Coverage.Devices"));
     FProcess = FSession.StartProcess(new ProcessInfo(FSession.SessionInfo));
 }