Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.13k stars 4.52k forks source link

Add AddSearchIndexerClient Extension Method for Azure AI Search #43233

Open xantari opened 2 months ago

xantari commented 2 months ago

Library name

Azure.Core.Extensions

Please describe the feature.

Currently you only have registration methods for AddSearchIndexClient and AddSearchClient.

It would be helpful to also add AddSearchIndexerClient to this: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/search/Azure.Search.Documents/src/SearchClientBuilderExtensions.cs

builder.AddClient<SearchIndexerClient, SearchClientOptions>((opts) =>
{
    return new SearchIndexerClient(new Uri(config.SearchServiceUrl), new AzureKeyCredential(config.SearchServiceQueryApiKey));
});

The above is the current work around (not the end of the world, but you had extension methods for the other client registrations so I wouldn't see why you wouldn't add this one as well.

github-actions[bot] commented 2 months ago

Thank you for your feedback. Tagging and routing to the team member best able to assist.

pallavit commented 2 months ago

@jsquire do we have a criteria on deciding when to add extensions for clients across our SDKs?

jsquire commented 2 months ago

@jsquire do we have a criteria on deciding when to add extensions for clients across our SDKs?

@pallavit: General guidance has been that we should have an extension to register every top-level client exposed by a library, unless they have special needs for use/lifetime management where passing them around doesn't make sense.

pallavit commented 2 months ago

It may be worth having a static analyzer for this then - we may have a few gaps in our SDKs. /cc: @m-nash do we have this added to the DPG generator i.e. we create an extension for each builder?