Share via


AspireTablesExtensions.AddKeyedAzureTableClient Method

Definition

Registers TableServiceClient as a singleton for given name in the services provided by the builder. Enables retries, corresponding health check, logging and telemetry.

public static void AddKeyedAzureTableClient (this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string name, Action<Aspire.Azure.Data.Tables.AzureDataTablesSettings>? configureSettings = default, Action<Azure.Core.Extensions.IAzureClientBuilder<Azure.Data.Tables.TableServiceClient,Azure.Data.Tables.TableClientOptions>>? configureClientBuilder = default);
static member AddKeyedAzureTableClient : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string * Action<Aspire.Azure.Data.Tables.AzureDataTablesSettings> * Action<Azure.Core.Extensions.IAzureClientBuilder<Azure.Data.Tables.TableServiceClient, Azure.Data.Tables.TableClientOptions>> -> unit
<Extension()>
Public Sub AddKeyedAzureTableClient (builder As IHostApplicationBuilder, name As String, Optional configureSettings As Action(Of AzureDataTablesSettings) = Nothing, Optional configureClientBuilder As Action(Of IAzureClientBuilder(Of TableServiceClient, TableClientOptions)) = Nothing)

Parameters

builder
IHostApplicationBuilder

The IHostApplicationBuilder to read config from and add services to.

name
String

The name of the component, which is used as the ServiceKey of the service and also to retrieve the connection string from the ConnectionStrings configuration section.

configureSettings
Action<AzureDataTablesSettings>

An optional method that can be used for customizing the AzureDataTablesSettings. It's invoked after the settings are read from the configuration.

configureClientBuilder
Action<IAzureClientBuilder<TableServiceClient,TableClientOptions>>

An optional method that can be used for customizing the IAzureClientBuilder<TClient,TOptions>.

Exceptions

Thrown when neither ConnectionString nor ServiceUri is provided.

Remarks

Reads the configuration from "Aspire:Azure:Data:Tables:{name}" section.

Applies to