Skip to content

Adding support to infer FromServices parameters #39926

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 9 commits into from
Feb 8, 2022

Conversation

brunolins16
Copy link
Member

Fixes #39667

@ghost ghost added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Feb 1, 2022
@TanayParikh TanayParikh added old-area-web-frameworks-do-not-use *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels and removed old-area-web-frameworks-do-not-use *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels labels Feb 1, 2022
@@ -39,12 +41,23 @@ public class ApiBehaviorOptions : IEnumerable<ICompatibilitySwitch>
/// When enabled, the following sources are inferred:
/// Parameters that appear as route values, are assumed to be bound from the path (<see cref="BindingSource.Path"/>).
/// Parameters of type <see cref="IFormFile"/> and <see cref="IFormFileCollection"/> are assumed to be bound from form.
/// Parameters that are complex (<see cref="ModelMetadata.IsComplexType"/>) and are registered in the DI Container (<see cref="IServiceCollection"/>) are assumed to be bound from the services <see cref="BindingSource.Services"/>, unless this
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the precedence order the same in minimal i.e is IServiceProviderIsService only used for complex types?

@brunolins16 brunolins16 marked this pull request as ready for review February 7, 2022 22:09
@brunolins16 brunolins16 requested a review from javiercn as a code owner February 7, 2022 22:09
@brunolins16 brunolins16 requested a review from pranavkm February 7, 2022 22:09
@brunolins16 brunolins16 enabled auto-merge (squash) February 8, 2022 00:17
@brunolins16 brunolins16 merged commit 44d89fa into dotnet:main Feb 8, 2022
@ghost ghost added this to the 7.0-preview2 milestone Feb 8, 2022
@brunolins16 brunolins16 deleted the brunolins16/issues/39667 branch August 2, 2022 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for implicit inference of FromServices for types that appear in DI
3 participants