This doesn't go through the Razor tag helper discovery pipeline because
this can really only ever work for ITagHelper based taghelpers. So
there's really no point in reusing that logic, which would be hard
anyway.
The View Engine now needs to know about pages :(. This isn't ideal but the
view engine needs to know what set of search paths to use. This was
already hardcoded for controllers vs controllers + areas. It felt right to
further hardcode instead of introduce a wierd abstraction that we only
use.
Additionally pages use a view location expander to implement an ascending
directory search.
This test uses the new features in the service provider to verify that we
don't reference any scoped services from singletons.
Note that this can't really cover the cases where we have optional
services or where we replace default services (like DI for controllers).
You'll just have to be careful.
* Added TagHelperFeature and TagHelperFeatureProvider to perform tag helper discovery.
* Changed tag helper discovery to use application parts when using tag helpers as services.
* Added FeatureTagHelperTypeResolver to resolve tag helper type definitions from the list of application parts.
* Added AddTagHelpersAsServices extension method on IMvcBuilder and IMvcCoreBuilder that
performs tag helper discovery through the ApplicationPartManager and registers those tag helpers as
services in the service collection. Assemblies should be added to the ApplicationPartManager
in order to discover tag helpers in them in them. The @addTagHelper directive is still required on
Razor pages to indicate what tag helpers to use.
* Added ViewComponentFeture and ViewComponentFeatureProvider to perform view component discovery.
* Changed view component discovery to use application parts.
* Changed ViewComponentDescriptorProvider to make use of Application parts.
* Added AddViewComponentsAsServices method on IMvcBuilder that performs view component
discovery through the ApplicationPartManager and registers those view components as
services in the service collection. Assemblies should be added to the ApplicationPartManager
in order to discover view components in them in them.
This commit introduces application parts as a concept on MVC.
An application part is an abstraction that allows you to expose some
feature or corncern in a way that is decoupled from their underlying source.
Examples of this include types in an assembly, emdeded resources, files on
disk etc.
Application parts are configured during startup by adding or removing them from
the application part manager available as part of IMvcBuilder and IMvcCoreBuilder.
The application part manager provides the ability to populate features from the
list of available application parts by using a list of application feature providers.
Application feature providers are responsible for populating a given feature given a
list of application parts.
Examples of application providers can be a ControllerFeatureProvider
that goes through the list of application parts, sees which one of those parts exposes types,
determines which of those types are controller types, and adds them to a ControllerFeature
that holds a list of all the types that will be considered controllers in the application.