Exemple #1
0
        public static NuGetApp Create(NuGetStartOptions options)
        {
            // Create a host
            var host = new LocalServiceHost(options);

            // Wrap it up in a NuGetApp and initialize it
            return(new NuGetApp(host));
        }
        public static NuGetApp Create(NuGetStartOptions options)
        {
            // Create a host
            var host = new LocalServiceHost(options);

            // Wrap it up in a NuGetApp and initialize it
            return new NuGetApp(host);
        }
Exemple #3
0
        private static NuGetStartOptions BuildOptions(string name, IEnumerable <string> urls, IEnumerable <string> services)
        {
            var options = new NuGetStartOptions();

            foreach (var url in urls)
            {
                options.Urls.Add(url);
            }

            options.Services = services;

            options.AppDescription = new ServiceHostDescription(
                ServiceHostInstanceName.Parse("nuget-local-0-" + name + "_IN0"),
                Environment.MachineName);

            return(options);
        }
        private static NuGetStartOptions BuildOptions(string name, IEnumerable<string> urls, IEnumerable<string> services)
        {
            var options = new NuGetStartOptions();
            
            foreach (var url in urls)
            {
                options.Urls.Add(url);
            }

            options.Services = services;

            options.AppDescription = new ServiceHostDescription(
                ServiceHostInstanceName.Parse("nuget-local-0-" + name + "_IN0"),
                Environment.MachineName);

            return options;
        }
        public LocalServiceHost(NuGetStartOptions options)
        {
            _options = options;

            if (_options.ConfigurationProvider != null)
            {
                _configProvider = _options.ConfigurationProvider;
            }
            else if (_options.Configuration != null)
            {
                _configProvider = s => {
                    string val;
                    if (!_options.Configuration.TryGetValue(s, out val))
                    {
                        return(null);
                    }
                    return(val);
                };
            }
            else
            {
                _configProvider = ConfigurationManager.AppSettings.Get;
            }

            // Resolve services
            var allServices = ServiceDefinition.GetAllServicesInAppDomain();

            if (options.Services.Any())
            {
                _services = options.Services.Select(s => ResolveService(s, allServices)).Where(s => s != null);
            }
            else
            {
                _services = allServices.Values;
            }

            EventStream = EventListener = new ObservableEventListener();
        }
        public LocalServiceHost(NuGetStartOptions options)
        {
            _options = options;

            if (_options.ConfigurationProvider != null)
            {
                _configProvider = _options.ConfigurationProvider;
            }
            else if (_options.Configuration != null)
            {
                _configProvider = s => {
                    string val;
                    if (!_options.Configuration.TryGetValue(s, out val))
                    {
                        return null;
                    }
                    return val;
                };
            }
            else
            {
                _configProvider = ConfigurationManager.AppSettings.Get;
            }

            // Resolve services
            var allServices = ServiceDefinition.GetAllServicesInAppDomain();
            if (options.Services.Any())
            {
                _services = options.Services.Select(s => ResolveService(s, allServices)).Where(s => s != null);
            }
            else
            {
                _services = allServices.Values;
            }

            EventStream = EventListener = new ObservableEventListener();
        }