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

Mark RegisterGeneratedFactory obsolete #1366

Merged
merged 6 commits into from
Feb 7, 2023
Merged

Conversation

tillig
Copy link
Member

@tillig tillig commented Feb 4, 2023

Fix #1297.

This marks RegisterGeneratedFactory extensions and GeneratedFactoryActivatorData with an [Obsolete] attribute indicating folks should upgrade to use Func<T> or delegate factories. Tests for the feature remain, but the obsolete warnings are suppressed around the tests so we don't see them during the build.

While I was here I picked up a couple of optimizations based on Roslyn analyzers:

  • Use conditional assignment
  • Use local function
  • Make struct readonly

@codecov
Copy link

codecov bot commented Feb 4, 2023

Codecov Report

Base: 78.22% // Head: 78.15% // Decreases project coverage by -0.07% ⚠️

Coverage data is based on head (75261ae) compared to base (b545b42).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1366      +/-   ##
===========================================
- Coverage    78.22%   78.15%   -0.07%     
===========================================
  Files          197      197              
  Lines         5653     5636      -17     
  Branches      1147     1149       +2     
===========================================
- Hits          4422     4405      -17     
  Misses         716      716              
  Partials       515      515              
Impacted Files Coverage Δ
src/Autofac/Builder/RegistrationExtensions.cs 35.71% <ø> (ø)
src/Autofac/Core/Resolving/SegmentedStack.cs 78.12% <ø> (ø)
src/Autofac/Core/ServiceRegistration.cs 28.57% <ø> (ø)
...eneratedFactories/GeneratedFactoryActivatorData.cs 71.42% <ø> (ø)
...actories/GeneratedFactoryRegistrationExtensions.cs 100.00% <ø> (ø)
...tofac/Core/Registration/ServiceRegistrationInfo.cs 77.35% <100.00%> (-1.02%) ⬇️
...nning/OpenGenericScanningRegistrationExtensions.cs 87.01% <100.00%> (-0.33%) ⬇️
...eatures/Scanning/ScanningRegistrationExtensions.cs 68.42% <100.00%> (-0.81%) ⬇️
src/Autofac/ModuleRegistrationExtensions.cs 59.01% <100.00%> (-2.53%) ⬇️
src/Autofac/RegistrationExtensions.Conditional.cs 77.77% <100.00%> (-4.05%) ⬇️
... and 2 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@alistairjevans alistairjevans left a comment

Choose a reason for hiding this comment

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

Looks great, only thing I noticed was a possible instance of a missing static on two of the new local methods.

Copy link
Member

@alistairjevans alistairjevans left a comment

Choose a reason for hiding this comment

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

👩‍🚀

@alistairjevans alistairjevans merged commit 2adc678 into develop Feb 7, 2023
@alistairjevans alistairjevans deleted the feature/1297 branch February 7, 2023 16:54
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.

Discussion: RegisterGeneratedFactory becoming obsolete
2 participants