Beispiel #1
0
        public NancyHost Configure(NancyServiceConfiguration nancyServiceConfiguration)
        {
            var nancyHostConfiguration = new HostConfiguration();

            if (nancyServiceConfiguration.NancyHostConfigurator != null)
            {
                nancyServiceConfiguration.NancyHostConfigurator(nancyHostConfiguration);
            }

            NancyServiceConfiguration = nancyServiceConfiguration;
            NancyHostConfiguration    = nancyHostConfiguration;

            _urlReservationsHelper = new UrlReservationsHelper(NancyServiceConfiguration.Uris, NancyHostConfiguration);

            if (NancyServiceConfiguration.Bootstrapper != null)
            {
                NancyHost = new NancyHost(NancyServiceConfiguration.Bootstrapper, NancyHostConfiguration, NancyServiceConfiguration.Uris.ToArray());
            }
            else
            {
                NancyHost = new NancyHost(NancyHostConfiguration, NancyServiceConfiguration.Uris.ToArray());
            }

            return(NancyHost);
        }
Beispiel #2
0
        public void Configure(NancyServiceConfiguration nancyServiceConfiguration)
        {
            var nancyHostConfiguration = new HostConfiguration();

            if (nancyServiceConfiguration.NancyHostConfigurator != null)
            {
              nancyServiceConfiguration.NancyHostConfigurator(nancyHostConfiguration);
            }

            NancyServiceConfiguration = nancyServiceConfiguration;
            NancyHostConfiguration = nancyHostConfiguration;

            _urlReservationsHelper = new UrlReservationsHelper(NancyServiceConfiguration.Uris, NancyHostConfiguration);


            NancyHost = new Lazy<NancyHost>(() => {
                if (NancyServiceConfiguration.Bootstrapper != null)
                {
                  return new NancyHost(NancyServiceConfiguration.Bootstrapper, NancyHostConfiguration, NancyServiceConfiguration.Uris.ToArray());
                }
                else
                {
                  return new NancyHost(NancyHostConfiguration, NancyServiceConfiguration.Uris.ToArray());
                }
              });
        }
Beispiel #3
0
        public void Configure(NancyServiceConfiguration nancyServiceConfiguration)
        {
            var nancyHostConfiguration = new HostConfiguration();

            nancyServiceConfiguration.NancyHostConfigurator?.Invoke(nancyHostConfiguration);

            NancyServiceConfiguration = nancyServiceConfiguration;
            NancyHostConfiguration    = nancyHostConfiguration;

            _urlReservationsHelper = new UrlReservationsHelper(NancyServiceConfiguration.Uris, NancyHostConfiguration);

            NancyHost = new Lazy <NancyHost>(CreateNancyHost);
        }
        public void Configure(NancyServiceConfiguration nancyServiceConfiguration)
        {
            var nancyHostConfiguration = new HostConfiguration();

            if (nancyServiceConfiguration.NancyHostConfigurator != null)
            {
              nancyServiceConfiguration.NancyHostConfigurator(nancyHostConfiguration);
            }

            NancyServiceConfiguration = nancyServiceConfiguration;
            NancyHostConfiguration = nancyHostConfiguration;

            _urlReservationsHelper = new UrlReservationsHelper(NancyServiceConfiguration.Uris, NancyHostConfiguration);

            NancyHost = new Lazy<NancyHost>(CreateNancyHost);
        }
        public NancyHost Configure(NancyServiceConfiguration nancyServiceConfiguration)
        {

            var nancyHostConfiguration = new HostConfiguration();

            if (nancyServiceConfiguration.NancyHostConfigurator != null)
            {
                nancyServiceConfiguration.NancyHostConfigurator(nancyHostConfiguration);
            }

            NancyServiceConfiguration = nancyServiceConfiguration;
            NancyHostConfiguration = nancyHostConfiguration;

            _urlReservationsHelper = new UrlReservationsHelper(NancyServiceConfiguration.Uris, NancyHostConfiguration);

            NancyHost = new NancyHost(NancyHostConfiguration, NancyServiceConfiguration.Uris.ToArray());
            return NancyHost;
        }
Beispiel #6
0
        public static ServiceConfigurator <T> WithNancyEndpoint <T>(this ServiceConfigurator <T> configurator, HostConfigurator hostconfigurator, Action <NancyServiceConfiguration> nancyConfigurator) where T : class
        {
            var nancyServiceConfiguration = new NancyServiceConfiguration();

            nancyConfigurator(nancyServiceConfiguration);

            var nancyService = new NancyService();

            nancyService.Configure(nancyServiceConfiguration);

            configurator.AfterStartingService(_ => nancyService.Start());

            configurator.BeforeStoppingService(_ => nancyService.Stop());

            hostconfigurator.BeforeInstall(_ => nancyService.BeforeInstall());

            hostconfigurator.BeforeUninstall(nancyService.BeforeUninstall);

            return(configurator);
        }