Skip to content

Add service lifetime support to DI helpers. #5880

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

Merged
merged 3 commits into from
Feb 12, 2025

Conversation

eiriktsarpalis
Copy link
Member

@eiriktsarpalis eiriktsarpalis commented Feb 11, 2025

Adds a ServiceLifetime optional parameter to all the DI helpers, defaulting to Singleton.

Fix #5875.

Microsoft Reviewers: Open in CodeFlow

@dotnet-comment-bot
Copy link
Collaborator

‼️ Found issues ‼️

Project Coverage Type Expected Actual
Microsoft.Extensions.AI.OpenAI Line 77 68.75 🔻
Microsoft.Extensions.AI.OpenAI Branch 77 50.41 🔻
Microsoft.Extensions.AI.Ollama Line 80 78.2 🔻
Microsoft.Extensions.Caching.Hybrid Line 86 82.77 🔻
Microsoft.Gen.MetadataExtractor Line 98 57.35 🔻
Microsoft.Gen.MetadataExtractor Branch 98 62.5 🔻

🎉 Good job! The coverage increased 🎉
Update MinCodeCoverage in the project files.

Project Expected Actual
Microsoft.Extensions.AI.AzureAIInference 91 92
Microsoft.Extensions.AI 88 89
Microsoft.Extensions.AI.Abstractions 83 85

Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=948675&view=codecoverage-tab

@eiriktsarpalis eiriktsarpalis enabled auto-merge (squash) February 12, 2025 16:22
@dotnet-comment-bot
Copy link
Collaborator

‼️ Found issues ‼️

Project Coverage Type Expected Actual
Microsoft.Extensions.Caching.Hybrid Line 86 82.77 🔻
Microsoft.Extensions.AI.Ollama Line 80 78.2 🔻
Microsoft.Extensions.AI.OpenAI Line 77 68.75 🔻
Microsoft.Extensions.AI.OpenAI Branch 77 50.41 🔻
Microsoft.Gen.MetadataExtractor Line 98 57.35 🔻
Microsoft.Gen.MetadataExtractor Branch 98 62.5 🔻

🎉 Good job! The coverage increased 🎉
Update MinCodeCoverage in the project files.

Project Expected Actual
Microsoft.Extensions.AI.AzureAIInference 91 92
Microsoft.Extensions.AI 88 89
Microsoft.Extensions.AI.Abstractions 83 85

Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=950106&view=codecoverage-tab

@eiriktsarpalis eiriktsarpalis merged commit b67faa0 into dotnet:main Feb 12, 2025
6 checks passed
@eiriktsarpalis eiriktsarpalis deleted the meai-di-lifetimes branch February 12, 2025 18:54
@jeffhandley jeffhandley added the area-ai Microsoft.Extensions.AI libraries label Mar 7, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Apr 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-ai Microsoft.Extensions.AI libraries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MEAI] IChatClient dependency extensions should support lifetimes beyond singleton
4 participants