Partager via


AspireTablesExtensions.AddAzureTableClient Method

Definition

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

public static void AddAzureTableClient (this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string connectionName, 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 AddAzureTableClient : 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 AddAzureTableClient (builder As IHostApplicationBuilder, connectionName 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.

connectionName
String

A name used 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" section.

Applies to