Skip to content
Docs Try Aspire

AspireAzureSearchExtensions Methods

Class Methods 2 members
Provides extension methods for registering Indexes.SearchIndexClient as a singleton in the services provided by the Hosting.IHostApplicationBuilder.
AddAzureSearchClient(IHostApplicationBuilder, string, Action<AzureSearchSettings>, Action<IAzureClientBuilder<SearchIndexClient, SearchClientOptions>>) Section titled AddAzureSearchClient(IHostApplicationBuilder, string, Action<AzureSearchSettings>, Action<IAzureClientBuilder<SearchIndexClient, SearchClientOptions>>) extension
Registers Indexes.SearchIndexClient as a singleton in the services provided by the builder.
public static class AspireAzureSearchExtensions
{
public static void AddAzureSearchClient(
this IHostApplicationBuilder builder,
string connectionName,
Action<AzureSearchSettings>? configureSettings = null,
Action<IAzureClientBuilder<SearchIndexClient, SearchClientOptions>>? configureClientBuilder = null)
{
// ...
}
}
builder IHostApplicationBuilder The Hosting.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> optional 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>> optional An optional method that can be used for customizing the Extensions.IAzureClientBuilder`2.
Reads the configuration from "Aspire:Azure:Search:Documents" section.
AddKeyedAzureSearchClient(IHostApplicationBuilder, string, Action<AzureSearchSettings>, Action<IAzureClientBuilder<SearchIndexClient, SearchClientOptions>>) Section titled AddKeyedAzureSearchClient(IHostApplicationBuilder, string, Action<AzureSearchSettings>, Action<IAzureClientBuilder<SearchIndexClient, SearchClientOptions>>) extension
Registers Indexes.SearchIndexClient as a singleton for given name in the services provided by the builder.
public static class AspireAzureSearchExtensions
{
public static void AddKeyedAzureSearchClient(
this IHostApplicationBuilder builder,
string name,
Action<AzureSearchSettings>? configureSettings = null,
Action<IAzureClientBuilder<SearchIndexClient, SearchClientOptions>>? configureClientBuilder = null)
{
// ...
}
}
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to.
name string The name of the component, which is used as the ServiceDescriptor.ServiceKey of the service and also to retrieve the connection string from the ConnectionStrings configuration section.
configureSettings Action<AzureSearchSettings> optional 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>> optional An optional method that can be used for customizing the Extensions.IAzureClientBuilder`2.
Reads the configuration from "Aspire:Azure:Search:Documents:{name}" section.