AspireAzureSearchExtensions Methods
ClassMethods2 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) { // ... }}Parameters
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.connectionNamestringA name used to retrieve the connection string from the ConnectionStrings configuration section.configureSettingsAction<AzureSearchSettings>optionalAn optional method that can be used for customizing the AzureSearchSettings. It's invoked after the settings are read from the configuration.configureClientBuilderAction<IAzureClientBuilder<SearchIndexClient, SearchClientOptions>>optionalAn optional method that can be used for customizing the Extensions.IAzureClientBuilder`2.Remarks
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) { // ... }}Parameters
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.namestringThe 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.configureSettingsAction<AzureSearchSettings>optionalAn optional method that can be used for customizing the AzureSearchSettings. It's invoked after the settings are read from the configuration.configureClientBuilderAction<IAzureClientBuilder<SearchIndexClient, SearchClientOptions>>optionalAn optional method that can be used for customizing the Extensions.IAzureClientBuilder`2.Remarks
Reads the configuration from "Aspire:Azure:Search:Documents:{name}" section.