Stumps.StumpsRunner.Start C# (CSharp) Method

Start() private method

private Start ( ) : void
return void
        public void Start()
        {
            // Prevent multiple simultaneous requests to start or stop the instance.
            lock (_syncRoot)
            {

                if (_started)
                {
                    return;
                }

                _started = true;

                // Initialize a new instance of the data access layer.
                var dataAccess = new DataAccess(this.Configuration.StoragePath);

                var factory = new ServerFactory();

                // Initialize and load a new instance of the proxy host.
                _host = new StumpsHost(factory, dataAccess);
                _host.Load();

                // Initialize the Nancy web server module.
                _webServer = new StumpsWebServer(_host, this.Configuration.WebApiPort);

                // Start the host and the web server
                _host.Start();
                _webServer.Start();

            }
        }

Usage Example

Esempio n. 1
0
        /// <summary>
        ///     Runs the instance of the Stumps server.
        /// </summary>
        public void RunInstance()
        {
            this.MessageWriter.Information(StartupResources.StartupStarting);

            using (var server = new StumpsRunner(this.Configuration))
            {
                server.Start();
                this.MessageWriter.Information(StartupResources.StartupComplete);

                Console.ReadLine();

                this.MessageWriter.Information(StartupResources.ShutdownStarting);
                server.Shutdown();
                this.MessageWriter.Information(StartupResources.ShutdownComplete);
            }
        }
All Usage Examples Of Stumps.StumpsRunner::Start