Ejemplo n.º 1
0
        /// <summary>
        /// Get service info of a given type when you know the Id
        /// </summary>
        /// <typeparam name="SI">Service info type you're looking for</typeparam>
        /// <param name="config">Configuration to search</param>
        /// <param name="id">Id of service</param>
        /// <returns>Requested implementation of <see cref="IServiceInfo"/></returns>
        public static SI GetServiceInfo <SI>(this IConfiguration config, string id)
            where SI : class
        {
            CloudFoundryServiceInfoCreator factory = CloudFoundryServiceInfoCreator.Instance(config);

            return(factory.GetServiceInfo <SI>(id));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get configuration info for all services of a given service type
        /// </summary>
        /// <typeparam name="SI">Service info type you're looking for</typeparam>
        /// <param name="config">Configuration to search</param>
        /// <returns>List of service infos</returns>
        public static List <SI> GetServiceInfos <SI>(this IConfiguration config)
            where SI : class
        {
            CloudFoundryServiceInfoCreator factory = CloudFoundryServiceInfoCreator.Instance(config);

            return(factory.GetServiceInfos <SI>());
        }
        public static CloudFoundryServiceInfoCreator Instance(IConfiguration config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            if (config == _config)
            {
                return(_me);
            }

            lock (_lock)
            {
                if (config == _config)
                {
                    return(_me);
                }

                _me = new CloudFoundryServiceInfoCreator(config);
            }
            return(_me);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Get service info when you know the Id
        /// </summary>
        /// <param name="config">Configuration to search</param>
        /// <param name="id">Id of service</param>
        /// <returns>Requested implementation of <see cref="IServiceInfo"/></returns>
        public static IServiceInfo GetServiceInfo(this IConfiguration config, string id)
        {
            var factory = CloudFoundryServiceInfoCreator.Instance(config);

            return(factory.GetServiceInfo(id));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Get configuration info for all services of a given service type
        /// </summary>
        /// <param name="config">Configuration to search</param>
        /// <param name="infoType">Type to search for</param>
        /// <returns>A list of relevant <see cref="IServiceInfo"/></returns>
        public static List <IServiceInfo> GetServiceInfos(this IConfiguration config, Type infoType)
        {
            var factory = CloudFoundryServiceInfoCreator.Instance(config);

            return(factory.GetServiceInfos(infoType));
        }