Exemple #1
0
        private void BuildServiceInfos()
        {
            _serviceInfos.Clear();

            CloudFoundryApplicationOptions appOpts = new CloudFoundryApplicationOptions();
            var aopSection = _config.GetSection(CloudFoundryApplicationOptions.CONFIGURATION_PREFIX);

            aopSection.Bind(appOpts);

            ApplicationInstanceInfo appInfo = new ApplicationInstanceInfo(appOpts);
            var serviceSection = _config.GetSection(CloudFoundryServicesOptions.CONFIGURATION_PREFIX);
            CloudFoundryServicesOptions serviceOpts = new CloudFoundryServicesOptions();

            serviceSection.Bind(serviceOpts);

            foreach (KeyValuePair <string, Service[]> serviceopt in serviceOpts.Services)
            {
                foreach (Service s in serviceopt.Value)
                {
                    IServiceInfoFactory factory = FindFactory(s);
                    if (factory != null)
                    {
                        if (factory.Create(s) is ServiceInfo info)
                        {
                            info.ApplicationInfo = appInfo;
                            _serviceInfos.Add(info);
                        }
                    }
                }
            }
        }
        private void BuildServiceInfos()
        {
            _serviceInfos.Clear();

            CloudFoundryApplicationOptions appOpts = new CloudFoundryApplicationOptions();

            _config.Bind(appOpts);
            ApplicationInstanceInfo appInfo = new ApplicationInstanceInfo(appOpts);

            CloudFoundryServicesOptions serviceOpts = new CloudFoundryServicesOptions();

            _config.Bind(serviceOpts);

            foreach (Service s in serviceOpts.Services)
            {
                IServiceInfoFactory factory = FindFactory(s);
                if (factory != null)
                {
                    var info = factory.Create(s) as ServiceInfo;
                    if (info != null)
                    {
                        info.ApplicationInfo = appInfo;
                        _serviceInfos.Add(info);
                    }
                }
            }
        }