// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
//
#nullable disable
using System;
using System.ClientModel.Primitives;
using System.Diagnostics.CodeAnalysis;
using Azure.Identity;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
namespace Azure.Search.Documents
{
/// Extension methods to add to an .
[Experimental("SCME0002")]
public static partial class SearchClientHostExtensions
{
/// Adds a singleton to the 's service collection.
/// The to add to.
/// The section of to use.
/// An that can be used to further configure the client.
public static IClientBuilder AddSearchClient(this IHostApplicationBuilder host, string sectionName)
{
return host.AddAzureClient(sectionName);
}
/// Adds a singleton to the 's service collection.
/// The to add to.
/// The section of to use.
/// Factory method to modify the after they are created.
/// An that can be used to further configure the client.
public static IClientBuilder AddSearchClient(this IHostApplicationBuilder host, string sectionName, Action configureSettings)
{
return host.AddAzureClient(sectionName, configureSettings);
}
/// Adds a keyed singleton to the 's service collection.
/// The to add to.
/// The unique key to register as.
/// The section of to use.
/// An that can be used to further configure the client.
public static IClientBuilder AddKeyedSearchClient(this IHostApplicationBuilder host, string key, string sectionName)
{
return host.AddKeyedAzureClient(key, sectionName);
}
/// Adds a keyed singleton to the 's service collection.
/// The to add to.
/// The unique key to register as.
/// The section of to use.
/// Factory method to modify the after they are created.
/// An that can be used to further configure the client.
public static IClientBuilder AddKeyedSearchClient(this IHostApplicationBuilder host, string key, string sectionName, Action configureSettings)
{
return host.AddKeyedAzureClient(key, sectionName, configureSettings);
}
}
}