Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ClientBuilderExtensions #8709

Closed
annelo-msft opened this issue Nov 10, 2019 · 7 comments · Fixed by #10984
Closed

Implement ClientBuilderExtensions #8709

annelo-msft opened this issue Nov 10, 2019 · 7 comments · Fixed by #10984
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. Cognitive - Text Analytics Cognitive Services
Milestone

Comments

@annelo-msft
Copy link
Member

No description provided.

@annelo-msft annelo-msft added Client This issue points to a problem in the data-plane of the library. Cognitive Services TextAnalytics labels Nov 10, 2019
@annelo-msft annelo-msft added this to the [2020] February milestone Dec 3, 2019
@mayurid mayurid modified the milestones: [2020] February, [2020] March Jan 21, 2020
@maririos
Copy link
Member

@annelo-msft could you provide more info about what the purpose of the issue is?

@maririos maririos removed this from the [2020] March milestone Feb 11, 2020
@maririos maririos reopened this Feb 12, 2020
@AlexGhiondea AlexGhiondea added this to the [2020] April milestone Mar 3, 2020
@AlexGhiondea
Copy link
Contributor

This is related to the way Dependency Injection works in ASP.NET Core.

https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/core/Microsoft.Extensions.Azure

@maririos
Copy link
Member

maririos commented Mar 4, 2020

@AlexGhiondea is this required for each service? Does it has to happen for GA or could it be after?

@maririos
Copy link
Member

maririos commented Mar 9, 2020

@pakrym could you explain to me the work needed here? I see the document Alex shared, but it isn't clear where I need to make the changes.
All we need to do is to register the client? or what else? Also, how do we test this?
What else am I missing?

@xantari
Copy link

xantari commented Mar 25, 2020

Question, what is the recommended way to register a SearchIndexClient in asp .net core? It seems there are no dependency injection samples for Azure Cognitive Search out there!

My guess is this:

services.AddSingleton<ISearchServiceClient>(new SearchServiceClient(projectOptions.SearchServiceName, new SearchCredentials(projectOptions.SearchServiceQueryApiKey)));

Then retrieve a search index client using

client.Indexes.GetClient("name of index");

@pakrym
Copy link
Contributor

pakrym commented Mar 25, 2020

@xantari because the library is in preview there is no extension method yet, I'm sure that would change in later previews or GA (cc @tg-msft @heaths).

For now you can use services.AddSingleton(new SearchIndexClient(...));

@tg-msft
Copy link
Member

tg-msft commented Mar 25, 2020

Yes - filed #10848 to track.

@maririos maririos self-assigned this Apr 1, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Mar 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. Cognitive - Text Analytics Cognitive Services
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants