autofac / Autofac

An addictive .NET IoC container
https://autofac.org
MIT License
4.48k stars 836 forks source link

Mark RegisterGeneratedFactory obsolete #1366

Closed tillig closed 1 year ago

tillig commented 1 year ago

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:

codecov[bot] commented 1 year ago

Codecov Report

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

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 ```diff @@ 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](https://codecov.io/gh/autofac/Autofac/pull/1366?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=autofac) | Coverage Δ | | |---|---|---| | [src/Autofac/Builder/RegistrationExtensions.cs](https://codecov.io/gh/autofac/Autofac/pull/1366?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=autofac#diff-c3JjL0F1dG9mYWMvQnVpbGRlci9SZWdpc3RyYXRpb25FeHRlbnNpb25zLmNz) | `35.71% <ø> (ø)` | | | [src/Autofac/Core/Resolving/SegmentedStack.cs](https://codecov.io/gh/autofac/Autofac/pull/1366?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=autofac#diff-c3JjL0F1dG9mYWMvQ29yZS9SZXNvbHZpbmcvU2VnbWVudGVkU3RhY2suY3M=) | `78.12% <ø> (ø)` | | | [src/Autofac/Core/ServiceRegistration.cs](https://codecov.io/gh/autofac/Autofac/pull/1366?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=autofac#diff-c3JjL0F1dG9mYWMvQ29yZS9TZXJ2aWNlUmVnaXN0cmF0aW9uLmNz) | `28.57% <ø> (ø)` | | | [...eneratedFactories/GeneratedFactoryActivatorData.cs](https://codecov.io/gh/autofac/Autofac/pull/1366?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=autofac#diff-c3JjL0F1dG9mYWMvRmVhdHVyZXMvR2VuZXJhdGVkRmFjdG9yaWVzL0dlbmVyYXRlZEZhY3RvcnlBY3RpdmF0b3JEYXRhLmNz) | `71.42% <ø> (ø)` | | | [...actories/GeneratedFactoryRegistrationExtensions.cs](https://codecov.io/gh/autofac/Autofac/pull/1366?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=autofac#diff-c3JjL0F1dG9mYWMvRmVhdHVyZXMvR2VuZXJhdGVkRmFjdG9yaWVzL0dlbmVyYXRlZEZhY3RvcnlSZWdpc3RyYXRpb25FeHRlbnNpb25zLmNz) | `100.00% <ø> (ø)` | | | [...tofac/Core/Registration/ServiceRegistrationInfo.cs](https://codecov.io/gh/autofac/Autofac/pull/1366?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=autofac#diff-c3JjL0F1dG9mYWMvQ29yZS9SZWdpc3RyYXRpb24vU2VydmljZVJlZ2lzdHJhdGlvbkluZm8uY3M=) | `77.35% <100.00%> (-1.02%)` | :arrow_down: | | [...nning/OpenGenericScanningRegistrationExtensions.cs](https://codecov.io/gh/autofac/Autofac/pull/1366?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=autofac#diff-c3JjL0F1dG9mYWMvRmVhdHVyZXMvU2Nhbm5pbmcvT3BlbkdlbmVyaWNTY2FubmluZ1JlZ2lzdHJhdGlvbkV4dGVuc2lvbnMuY3M=) | `87.01% <100.00%> (-0.33%)` | :arrow_down: | | [...eatures/Scanning/ScanningRegistrationExtensions.cs](https://codecov.io/gh/autofac/Autofac/pull/1366?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=autofac#diff-c3JjL0F1dG9mYWMvRmVhdHVyZXMvU2Nhbm5pbmcvU2Nhbm5pbmdSZWdpc3RyYXRpb25FeHRlbnNpb25zLmNz) | `68.42% <100.00%> (-0.81%)` | :arrow_down: | | [src/Autofac/ModuleRegistrationExtensions.cs](https://codecov.io/gh/autofac/Autofac/pull/1366?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=autofac#diff-c3JjL0F1dG9mYWMvTW9kdWxlUmVnaXN0cmF0aW9uRXh0ZW5zaW9ucy5jcw==) | `59.01% <100.00%> (-2.53%)` | :arrow_down: | | [src/Autofac/RegistrationExtensions.Conditional.cs](https://codecov.io/gh/autofac/Autofac/pull/1366?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=autofac#diff-c3JjL0F1dG9mYWMvUmVnaXN0cmF0aW9uRXh0ZW5zaW9ucy5Db25kaXRpb25hbC5jcw==) | `77.77% <100.00%> (-4.05%)` | :arrow_down: | | ... and [2 more](https://codecov.io/gh/autofac/Autofac/pull/1366?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=autofac) | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=autofac). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=autofac)

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