IAzureClientFactoryBuilderWithCredential.RegisterClientFactory<TClient,TOptions> Method

Definition

Registers a client in dependency injection container the using the factory to create a client instance.

public Azure.Core.Extensions.IAzureClientBuilder<TClient,TOptions> RegisterClientFactory<TClient,TOptions> (Func<TOptions,Azure.Core.TokenCredential,TClient> clientFactory, bool requiresCredential = true) where TOptions : class;
abstract member RegisterClientFactory : Func<'Options, Azure.Core.TokenCredential, 'Client (requires 'Options : null)> * bool -> Azure.Core.Extensions.IAzureClientBuilder<'Client, 'Options (requires 'Options : null)> (requires 'Options : null)
Public Function RegisterClientFactory(Of TClient, TOptions) (clientFactory As Func(Of TOptions, TokenCredential, TClient), Optional requiresCredential As Boolean = true) As IAzureClientBuilder(Of TClient, TOptions)

Type Parameters

TClient

The type of the client.

TOptions

The client options type used the client.

Parameters

clientFactory
Func<TOptions,TokenCredential,TClient>

The factory, that given the instance of options and credential, returns a client instance.

requiresCredential
Boolean

Specifies whether the credential is optional (client supports anonymous authentication).

Returns

IAzureClientBuilder<TClient,TOptions> that allows customizing the client registration.

Applies to