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

WIP Feature: Use Microsoft KeyedServiceProvider #1075

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

OleksandrTsvirkun
Copy link

@OleksandrTsvirkun OleksandrTsvirkun commented Feb 16, 2024

Use KeyedServiceProvider instead of ContractDictionary for Splat.Microsoft.Extensions.DependencyInjection adapter.

What is the current behavior?
Splat and ServiceProvider provides different instances of a singleton object
#1074

What is the new behavior?
Splat and ServiceProvider provides the same instance of a singleton object

What might this PR break?
Nothing known.

Please check if the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Other information:

Copy link

codecov bot commented Feb 16, 2024

Codecov Report

Attention: Patch coverage is 62.85714% with 13 lines in your changes are missing coverage. Please review.

Project coverage is 71.79%. Comparing base (1803c70) to head (7f8d1b0).
Report is 60 commits behind head on main.

Files Patch % Lines
...DependencyInjection/MicrosoftDependencyResolver.cs 62.85% 5 Missing and 8 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1075      +/-   ##
==========================================
- Coverage   71.87%   71.79%   -0.08%     
==========================================
  Files          96       96              
  Lines        4483     4429      -54     
  Branches      569      557      -12     
==========================================
- Hits         3222     3180      -42     
+ Misses       1074     1068       -6     
+ Partials      187      181       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@dpvreony dpvreony left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your efforts on this.

can we hold, until we have a think of the overall shape of this class. my heads been running through this and I think there's gaps in the unit tests around the use of MicrosoftDependencyResolver(IServiceProvider serviceProvider) and Register that aren't related to the PR itself.

if these need cleaning up it might make sense to make MicrosoftDependencyResolver(IServiceProvider serviceProvider) become MicrosoftDependencyResolver(IKeyedServiceProvider serviceProvider) to remove a bunch of the is casts as well.

@OleksandrTsvirkun
Copy link
Author

@dpvreony In this case should I provide these test you have mentioned?
I need to take some time to think about use cases.
Thanks for corresponding

@dpvreony
Copy link
Member

@dpvreony In this case should I provide these test you have mentioned? I need to take some time to think about use cases. Thanks for corresponding

leave it with me

@dpvreony
Copy link
Member

dpvreony commented May 9, 2024

actually the net6 version supports IKeyedServiceProvider with v8 of the package. headache of framework vs packages

image

i'll tidy up and get this merged

@dpvreony dpvreony changed the title Feature: Use Microsoft KeyedServiceProvider WIP Feature: Use Microsoft KeyedServiceProvider May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants