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

Extend ASP.NET Core Integration documentation to reflect the parameter binding changes made in .NET 7 #179

Open
alistairjevans opened this issue Jan 3, 2024 · 0 comments

Comments

@alistairjevans
Copy link
Member

In .NET 7, when IServiceProviderIsService.IsService was introduced, the ASP.NET Core framework attempts to detect if something is a service, and if we indicate it is, that will be used as the source of binding, as opposed to the [FromBody] binding, which was the default before.

In Autofac rules, all collections are valid services (but with an empty set if no registrations have been made), so from .NET 7 on, ASP.NET Core will inject empty collections from Autofac instead of binding the body content.

We should add to our docs for ASP.NET Integration to detail this point and indicate that users should be explicit with [FromBody] where appropriate to prevent automatic service injection.

See autofac/Autofac.Extensions.DependencyInjection#114

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

No branches or pull requests

1 participant