Class IConfigurationExtensions
- Namespace
- Steeltoe.CloudFoundry.Connector
- Assembly
- Steeltoe.CloudFoundry.ConnectorBase.dll
public static class IConfigurationExtensions
- Inheritance
-
IConfigurationExtensions
- Inherited Members
Methods
GetRequiredServiceInfo<SI>(IConfiguration, string)
Get info for a named service
public static SI GetRequiredServiceInfo<SI>(this IConfiguration config, string serviceName) where SI : class
Parameters
config
IConfigurationConfiguration to retrieve service info from
serviceName
stringName of the service
Returns
- SI
Information requried to connect to provisioned service
Type Parameters
SI
Type of Service Info to return
Exceptions
- ConnectorException
Thrown when service info isn't found
GetServiceInfo(IConfiguration, string)
Get service info when you know the Id
public static IServiceInfo GetServiceInfo(this IConfiguration config, string id)
Parameters
config
IConfigurationConfiguration to search
id
stringId of service
Returns
- IServiceInfo
Requested implementation of IServiceInfo
GetServiceInfo<SI>(IConfiguration, string)
Get service info of a given type when you know the Id
public static SI GetServiceInfo<SI>(this IConfiguration config, string id) where SI : class
Parameters
config
IConfigurationConfiguration to search
id
stringId of service
Returns
- SI
Requested implementation of IServiceInfo
Type Parameters
SI
Service info type you're looking for
GetServiceInfos(IConfiguration, Type)
Get configuration info for all services of a given service type
public static List<IServiceInfo> GetServiceInfos(this IConfiguration config, Type infoType)
Parameters
config
IConfigurationConfiguration to search
infoType
TypeType to search for
Returns
- List<IServiceInfo>
A list of relevant IServiceInfo
GetServiceInfos<SI>(IConfiguration)
Get configuration info for all services of a given service type
public static List<SI> GetServiceInfos<SI>(this IConfiguration config) where SI : class
Parameters
config
IConfigurationConfiguration to search
Returns
- List<SI>
List of service infos
Type Parameters
SI
Service info type you're looking for
GetSingletonServiceInfo<SI>(IConfiguration)
Get Service Info from IConfiguration
public static SI GetSingletonServiceInfo<SI>(this IConfiguration config) where SI : class
Parameters
config
IConfigurationConfiguration to retrieve service info from
Returns
- SI
Information requried to connect to provisioned service
Type Parameters
SI
Type of Service Info to return
Exceptions
- ConnectorException
Thrown when multple matching services are found
HasCloudFoundryServiceConfigurations(IConfiguration)
Evaluate whether an IConfiguration contains services bound by Cloud Foundry
public static bool HasCloudFoundryServiceConfigurations(this IConfiguration config)
Parameters
config
IConfigurationApplication Configuration
Returns
- bool
true if vcap:services found in config, othwerwise false