Class CloudFoundryServiceCollectionExtensions
- Namespace
- Steeltoe.Extensions.Configuration.CloudFoundry
- Assembly
- Steeltoe.Extensions.Configuration.CloudFoundryCore.dll
Extension methods for adding services related to CloudFoundry
public static class CloudFoundryServiceCollectionExtensions
- Inheritance
-
CloudFoundryServiceCollectionExtensions
- Inherited Members
Methods
ConfigureCloudFoundryOptions(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.
public static IServiceCollection ConfigureCloudFoundryOptions(this IServiceCollection services, IConfiguration config)
Parameters
services
IServiceCollectionthe service container
config
IConfigurationthe applications configuration
Returns
- 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.
public static IServiceCollection ConfigureCloudFoundryService<TOption>(this IServiceCollection services, IConfiguration config, string serviceName) where TOption : AbstractServiceOptions
Parameters
services
IServiceCollectionthe service container
config
IConfigurationthe applications configuration
serviceName
stringthe Cloud Foundry service name to bind to the options type
Returns
- IServiceCollection
service container
Type Parameters
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.
public static IServiceCollection ConfigureCloudFoundryServices<TOption>(this IServiceCollection services, IConfiguration config, string serviceLabel) where TOption : AbstractServiceOptions
Parameters
services
IServiceCollectionthe service container
config
IConfigurationthe applications configuration
serviceLabel
stringthe Cloud Foundry service label to use to bind to the options type
Returns
- IServiceCollection
serice container
Type Parameters
TOption
the options type