Working PrincipleΒΆ
ExtCore is included into a project using two extension methods: AddExtCore
and UseExtCore
.
First of all, inside the AddExtCore
method ExtCore discovers and loads the assemblies (using the implementation of the
IAssemblyProvider interface).
When the assemblies are discovered and loaded it caches it inside the
ExtensionManager static class.
This class is the entry point for the ExtCore type discovery mechanism, all extensions can use it to get the information
about each other.
Then, using the AddExtCore
and UseExtCore
methods, ExtCore executes user actions (code fragments) from all the extensions
inside the ConfigureServices
and Configure
methods. These actions are defined by the implementations of the
IConfigureServicesAction and
IConfigureAction
interfaces and allows developer to specify the execution order by using the Priority
property.
This is one of the key features, because it allows the extensions to execute their own code during the
web application initialization and startup. They can register services, add middleware etc.
ExtCore.Mvc extension also defines two more action interfaces which might be used to configure MVC: IAddMvcAction and IUseMvcAction ones.
ExtCore.Mvc extension discovers all the views (added as resources and/or precompiled) and static content (added as resources)
and make it accessible using the
custom implementation
of the IFileProvider
interface.