コード例 #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 && factory.Create(s) is ServiceInfo info)
                    {
                        info.ApplicationInfo = appInfo;
                        ServiceInfos.Add(info);
                    }
                }
            }
        }
コード例 #2
0
        private void BuildServiceInfos()
        {
            ServiceInfos.Clear();

            var appInfo     = new CloudFoundryApplicationOptions(_config);
            var serviceOpts = new CloudFoundryServicesOptions(_config);

            foreach (var serviceopt in serviceOpts.Services)
            {
                foreach (var s in serviceopt.Value)
                {
                    var factory = FindFactory(s);
                    if (factory != null && factory.Create(s) is ServiceInfo info)
                    {
                        info.ApplicationInfo = appInfo;
                        ServiceInfos.Add(info);
                    }
                }
            }
        }