Class IConfigurationExtensions
Inheritance
Namespace: Steeltoe.Connector
Assembly: Steeltoe.Connector.ConnectorBase.dll
Syntax
public static class IConfigurationExtensions : object
Methods
| Edit this page View SourceAddConnectionStrings(IConfigurationBuilder)
Adds a configuration provider that uses Connector logic to fulfill requests for GetConnectionString("serviceType") or GetConnectionString("serviceBindingName")
Declaration
public static IConfigurationBuilder AddConnectionStrings(this IConfigurationBuilder builder)
Parameters
Type | Name | Description |
---|---|---|
IConfigurationBuilder | builder |
Returns
Type | Description |
---|---|
IConfigurationBuilder |
GetRequiredServiceInfo<TServiceInfo>(IConfiguration, String)
Get info for a named service
Declaration
public static TServiceInfo GetRequiredServiceInfo<TServiceInfo>(this IConfiguration configuration, string serviceName)
where TServiceInfo : class
Parameters
Type | Name | Description |
---|---|---|
IConfiguration | configuration | Configuration to retrieve service info from |
System.String | serviceName | Name of the service |
Returns
Type | Description |
---|---|
TServiceInfo | Information requried to connect to provisioned service |
Type Parameters
Name | Description |
---|---|
TServiceInfo | Type of Service Info to return |
Exceptions
Type | Condition |
---|---|
ConnectorException | Thrown when service info isn't found |
GetServiceInfo(IConfiguration, String)
Get service info when you know the Id
Declaration
public static IServiceInfo GetServiceInfo(this IConfiguration configuration, string id)
Parameters
Type | Name | Description |
---|---|---|
IConfiguration | configuration | Configuration to search |
System.String | id | Id of service |
Returns
Type | Description |
---|---|
IServiceInfo | Requested implementation of IServiceInfo |
GetServiceInfo<TServiceInfo>(IConfiguration, String)
Get service info of a given type when you know the Id
Declaration
public static TServiceInfo GetServiceInfo<TServiceInfo>(this IConfiguration configuration, string id)
where TServiceInfo : class
Parameters
Type | Name | Description |
---|---|---|
IConfiguration | configuration | Configuration to search |
System.String | id | Id of service |
Returns
Type | Description |
---|---|
TServiceInfo | Requested implementation of IServiceInfo |
Type Parameters
Name | Description |
---|---|
TServiceInfo | Service info type you're looking for |
GetServiceInfos(IConfiguration, Type)
Get configuration info for all services of a given service type
Declaration
public static IEnumerable<IServiceInfo> GetServiceInfos(this IConfiguration configuration, Type infoType)
Parameters
Type | Name | Description |
---|---|---|
IConfiguration | configuration | Configuration to search |
Type | infoType | Type to search for |
Returns
Type | Description |
---|---|
IEnumerable<IServiceInfo> | A list of relevant IServiceInfo |
GetServiceInfos<TServiceInfo>(IConfiguration)
Get configuration info for all services of a given service type
Declaration
public static IEnumerable<TServiceInfo> GetServiceInfos<TServiceInfo>(this IConfiguration configuration)
where TServiceInfo : class
Parameters
Type | Name | Description |
---|---|---|
IConfiguration | configuration | Configuration to search |
Returns
Type | Description |
---|---|
IEnumerable<TServiceInfo> | List of service infos |
Type Parameters
Name | Description |
---|---|
TServiceInfo | Service info type you're looking for |
GetSingletonServiceInfo<TServiceInfo>(IConfiguration)
Get Service Info from IConfiguration
Declaration
public static TServiceInfo GetSingletonServiceInfo<TServiceInfo>(this IConfiguration config)
where TServiceInfo : class
Parameters
Type | Name | Description |
---|---|---|
IConfiguration | config | Configuration to retrieve service info from |
Returns
Type | Description |
---|---|
TServiceInfo | Information requried to connect to provisioned service |
Type Parameters
Name | Description |
---|---|
TServiceInfo | Type of Service Info to return |
Exceptions
Type | Condition |
---|---|
ConnectorException | Thrown when multple matching services are found |
HasCloudFoundryServiceConfigurations(IConfiguration)
Evaluate whether an IConfiguration contains services bound by Cloud Foundry
Declaration
public static bool HasCloudFoundryServiceConfigurations(this IConfiguration configuration)
Parameters
Type | Name | Description |
---|---|---|
IConfiguration | configuration | Application Configuration |
Returns
Type | Description |
---|---|
System.Boolean | true if vcap:services found in config, otherwise false |
HasKubernetesServiceBindings(IConfiguration)
Evaluate whether an IConfiguration contains Kubernetes service bindings.
Declaration
public static bool HasKubernetesServiceBindings(this IConfiguration configuration)
Parameters
Type | Name | Description |
---|---|---|
IConfiguration | configuration | Application Configuration. |
Returns
Type | Description |
---|---|
System.Boolean | true if k8s:bindings found in configuration, otherwise false. |