Example #1
0
        public void InitializeHostedService(IServiceConfigurator <object> cfg)
        {
            cfg.HowToBuildService(serviceBuilder => new object());

            cfg.WhenStarted(a => { Started.Release(); });
            cfg.WhenStopped(a => { Stopped.Release(); });
        }
Example #2
0
        public void InitializeHostedService(IServiceConfigurator <InProcessKlingerWebServer> cfg)
        {
            var repo = new EnvironmentValidatorRepository();

            cfg.HowToBuildService(name => new InProcessKlingerWebServer(8008, repo));
            cfg.WhenStarted(s => s.Start());
            cfg.WhenStopped(s => s.Stop());
        }
 public override void InitializeHostedService(IServiceConfigurator <IServerStart> cfg)
 {
     cfg.HowToBuildService(f => Container.Resolve <IServerStart>());
     cfg.Named("QUADAutomotive Service");
     cfg.WhenStarted(c => c.Start());
     cfg.WhenStopped(c => c.Stop());
     cfg.WhenPaused(c => c.Pause());
     cfg.WhenContinued(c => c.Continue());
 }
Example #4
0
 public void InitializeHostedService(IServiceConfigurator <TheClock> cfg)
 {
     cfg.HowToBuildService(n => new TheClock());
     cfg.WhenStarted(s =>
     {
         XmlConfigurator.Configure(new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "clock.log4net.config")));
         s.Start();
     });
     cfg.WhenStopped(s => s.Stop());
 }
        public void InitializeHostedService(IServiceConfigurator <BottleService> cfg)
        {
            if (cfg == null)
            {
                throw new ArgumentNullException("cfg");
            }

            cfg.HowToBuildService(name => new BottleService());
            cfg.WhenStarted(s => s.Start());
            cfg.WhenStopped(s => s.Stop());
        }
Example #6
0
        private static void ConfigureService <TService, TRegistry>(IServiceConfigurator <TService> service, Action <TService> start, Action <TService> stop)
            where TRegistry : Registry
        {
            var registry = FastActivator <TRegistry> .Create(ObjectFactory.Container);

            ObjectFactory.Configure(cfg =>
            {
                cfg.For <IConfiguration>().Singleton().Use <Configuration>();
                cfg.AddRegistry(registry);
            });
            service.HowToBuildService(builder => ObjectFactory.GetInstance <TService>());

            service.WhenStarted(start);
            service.WhenStopped(stop);
        }
Example #7
0
        private static void ConfigureService <TService, TRegistry>(IServiceConfigurator <TService> service, Action <TService> start, Action <TService> stop)
            where TRegistry : Registry
        {
            var container = new Container(x =>
            {
                x.For <IConfiguration>()
                .Singleton()
                .Add <Configuration>();

                x.For <TService>()
                .Singleton()
                .Use <TService>();
            });

            TRegistry registry = FastActivator <TRegistry> .Create(container);

            container.Configure(x => x.AddRegistry(registry));

            service.HowToBuildService(builder => container.GetInstance <TService>());
            service.WhenStarted(start);
            service.WhenStopped(stop);
        }
 public void InitializeHostedService(IServiceConfigurator <RRServer> cfg)
 {
     cfg.HowToBuildService(s => new RRServer());
     cfg.WhenStarted(s => s.Start());
     cfg.WhenStopped(s => s.Stop());
 }
Example #9
0
 public void InitializeHostedService(IServiceConfigurator <BottleService> cfg)
 {
     cfg.HowToBuildService(name => new BottleService());
     cfg.WhenStarted(s => s.Start());
     cfg.WhenStopped(s => s.Stop());
 }