Class CloudFoundryServiceCollectionExtensions
Extension methods for adding services related to CloudFoundry
Inheritance
Namespace: Steeltoe.Extensions.Configuration.CloudFoundry
Assembly: Steeltoe.Extensions.Configuration.CloudFoundryBase.dll
Syntax
public static class CloudFoundryServiceCollectionExtensions : object
Methods
| Edit this page View SourceConfigureCloudFoundryOptions(IServiceCollection, IConfiguration)
Bind configuration data into CloudFoundryApplicationOptions and CloudFoundryServicesOptions and add both to the provided service container as configured TOptions. You can then inject both options using the normal Options pattern.
Declaration
public static IServiceCollection ConfigureCloudFoundryOptions(this IServiceCollection services, IConfiguration config)
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | the service container |
IConfiguration | config | the applications configuration |
Returns
Type | Description |
---|---|
IServiceCollection | service container |
ConfigureCloudFoundryService<TOption>(IServiceCollection, IConfiguration, String)
Find the Cloud Foundry service with the serviceName
in VCAP_SERVICES and bind the configuration data from
the provided config
into the options type and add it to the provided service container as a configured named TOption.
The name of the TOption will be the serviceName
. You can then inject the option using the normal Options pattern.
Declaration
public static IServiceCollection ConfigureCloudFoundryService<TOption>(this IServiceCollection services, IConfiguration config, string serviceName)
where TOption : CloudFoundryServicesOptions
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | the service container |
IConfiguration | config | the applications configuration |
System.String | serviceName | the Cloud Foundry service name to bind to the options type |
Returns
Type | Description |
---|---|
IServiceCollection | service container |
Type Parameters
Name | Description |
---|---|
TOption | the options type |
ConfigureCloudFoundryServices<TOption>(IServiceCollection, IConfiguration, String)
Find all of the Cloud Foundry services with the serviceLabel
in VCAP_SERVICES and bind the configuration data from
the provided config
into the options type and add them all to the provided service container as a configured named TOptions.
The name of each TOption will be the the name of the Cloud Foundry service binding. You can then inject all the options using the normal Options pattern.
Declaration
public static IServiceCollection ConfigureCloudFoundryServices<TOption>(this IServiceCollection services, IConfiguration config, string serviceLabel)
where TOption : CloudFoundryServicesOptions
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | the service container |
IConfiguration | config | the applications configuration |
System.String | serviceLabel | the Cloud Foundry service label to use to bind to the options type |
Returns
Type | Description |
---|---|
IServiceCollection | serice container |
Type Parameters
Name | Description |
---|---|
TOption | the options type |