Class DiscoveryHostBuilderExtensions
Inheritance
Namespace: Steeltoe.Discovery.Client
Assembly: Steeltoe.Discovery.ClientBase.dll
Syntax
csharp
public static class DiscoveryHostBuilderExtensions : object
Methods
| Edit this page View SourceAddDiscoveryClient(IHostBuilder)
Adds service discovery to your application. This method can be used in place of configuration via your Startup class.
Uses reflection to find discovery client packages. If no package is found, a Steeltoe.
Declaration
csharp
public static IHostBuilder AddDiscoveryClient(this IHostBuilder hostBuilder)
Parameters
Type | Name | Description |
---|---|---|
IHost |
hostBuilder | Your HostBuilder |
Returns
Type | Description |
---|---|
IHost |
Remarks
Also configures named HttpClients "DiscoveryRandom" and "DiscoveryRoundRobin" for automatic injection
Exceptions
Type | Condition |
---|---|
Connector |
Thrown if no service info with expected name or type are found or when multiple service infos are found and a single was expected |
AddServiceDiscovery(IHostBuilder, Action<DiscoveryClientBuilder>)
Adds service discovery to your application. This method can be used in place of configuration via your Startup class.
If optionsAction
is not provided, a Steeltoe.
Declaration
csharp
public static IHostBuilder AddServiceDiscovery(this IHostBuilder hostBuilder, Action<DiscoveryClientBuilder> optionsAction)
Parameters
Type | Name | Description |
---|---|---|
IHost |
hostBuilder | Your HostBuilder |
Action<Discovery |
optionsAction | Select the discovery client implementation |
Returns
Type | Description |
---|---|
IHost |
Remarks
Also configures named HttpClients "DiscoveryRandom" and "DiscoveryRoundRobin" for automatic injection
Exceptions
Type | Condition |
---|---|
Connector |
Thrown if no service info with expected name or type are found or when multiple service infos are found and a single was expected |