-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add overload to AddControllerAsServices that uses the default controller discovery logic #4014
Comments
To be clear, this pretty much means a single call to
Because the |
Oh, and the controller type itself has to be registered in some way, DUH. How do you get a registered Isn't this a bit of chicken and egg? You need to resolve from the container in order to add to it? 😄 |
Nah, we just assume the default type provider if you're using any of these methods. If you need to do something different these methods are only like 5 lines of code so write your own. |
And what is the default going forward? |
I thought we were talking about the
|
Basically, you want to ask the |
Should this behavior actually be the default? |
That came up but it's actually really hard to remove it if you don't want that behavior by default. You basically have to reverse engineer the controller type provider and remove services |
Iterating on design in this area - #4089 |
…efault controller discovery logic. * Added ControllerFeature and ControllerFeatureProvider to perform controller discovery. * Changed controller discovery to use application parts. * Changed ControllerActionDescriptorProvider to make use of Application parts. * Simplified AddControllerAsServices to not accept any parameter and perform controller discovery through the ApplicationPartManager in the IMvcBuilder and IMvcCoreBuilder. Assemblies should be added to the ApplicationPartManager in order to discover controllers in them.
…efault controller discovery logic. * Added ControllerFeature and ControllerFeatureProvider to perform controller discovery. * Changed controller discovery to use application parts. * Changed ControllerActionDescriptorProvider to make use of Application parts. * Simplified AddControllerAsServices to not accept any parameter and perform controller discovery through the ApplicationPartManager in the IMvcBuilder and IMvcCoreBuilder. Assemblies should be added to the ApplicationPartManager in order to discover controllers in them.
…efault controller discovery logic. * Added ControllerFeature and ControllerFeatureProvider to perform controller discovery. * Changed controller discovery to use application parts. * Changed ControllerActionDescriptorProvider to make use of Application parts. * Simplified AddControllerAsServices to not accept any parameter and perform controller discovery through the ApplicationPartManager in the IMvcBuilder and IMvcCoreBuilder. Assemblies should be added to the ApplicationPartManager in order to discover controllers in them.
It should use the default controller discovery logic baked into these
Mvc/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcCoreServiceCollectionExtensions.cs
Lines 81 to 88 in 47351aa
The text was updated successfully, but these errors were encountered: