Share via


AspireAzureSearchExtensions.AddAzureSearchClient Method

Definition

Registers SearchIndexClient as a singleton in the services provided by the builder.

public static void AddAzureSearchClient (this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string connectionName, Action<Aspire.Azure.Search.Documents.AzureSearchSettings>? configureSettings = default, Action<Azure.Core.Extensions.IAzureClientBuilder<Azure.Search.Documents.Indexes.SearchIndexClient,Azure.Search.Documents.SearchClientOptions>>? configureClientBuilder = default);
static member AddAzureSearchClient : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string * Action<Aspire.Azure.Search.Documents.AzureSearchSettings> * Action<Azure.Core.Extensions.IAzureClientBuilder<Azure.Search.Documents.Indexes.SearchIndexClient, Azure.Search.Documents.SearchClientOptions>> -> unit
<Extension()>
Public Sub AddAzureSearchClient (builder As IHostApplicationBuilder, connectionName As String, Optional configureSettings As Action(Of AzureSearchSettings) = Nothing, Optional configureClientBuilder As Action(Of IAzureClientBuilder(Of SearchIndexClient, SearchClientOptions)) = 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<AzureSearchSettings>

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

configureClientBuilder
Action<IAzureClientBuilder<SearchIndexClient,SearchClientOptions>>

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

Remarks

Reads the configuration from "Aspire:Azure:Search:Documents" section.

Applies to