Esempio n. 1
0
        private static void Main()
        {
            var conf = new Configuration(ExecutionEnvironment.Test);

            BootStrapDependencies(conf);
            HostFactory.Run(x =>
            {
                RunAsExtensions.RunAs(x, conf.ServiceUserName, conf.ServiceUserPasswordEncrypted);
                x.SetDescription("Calculates and provides calendar and product info data.");
                StartModeExtensions.StartManually(x);
                x.SetDisplayName(conf.ServiceDisplayName);
                x.SetServiceName(conf.ServiceName);
                ServiceExtensions.Service <PricingService>(x, s =>
                {
                    s.ConstructUsing(
                        name =>
                        new PricingService(ResolutionExtensions.Resolve <Configuration>(Container)));
                    ServiceConfiguratorExtensions.WhenStarted <PricingService>(s, tc => tc.OnStart());
                    ServiceConfiguratorExtensions.WhenStopped <PricingService>(s, tc => tc.OnStop());
                    ServiceConfiguratorExtensions.WhenShutdown <PricingService>(s, tc => tc.OnStop());
                });
                InstallHostConfiguratorExtensions.BeforeInstall(x, () => NetShellCmdLineTool.RegisterHttpNamespace(conf));
                UninstallHostConfiguratorExtensions.AfterUninstall(x, () => NetShellCmdLineTool.UnregisterHttpNamespace(conf));
            });
        }