two critical properties in Abpbootstrapper: Iiocmanager and Iabpmodulemanager
public class abpbootstrapper:idisposable
{
///<summary>
///Gets Iiocmanager object used by this Clas S.
</summary> public
Iiocmanager Iocmanager {get; private set;}
<summary>
///is this object disposed before?
</summary>
protected bool isdisposed;
Private Iabpmodulemanager _modulemanager;
//.........
}
Iiocmanager internally wraps a castle-dependent injection container IWindsorContainer (ABP uses a castle Windor framework, which is based on some encapsulation),
interceptors for all types of registrations, parsing, and subsequent AOP mechanisms are registered in the container, and the specific registration and parsing functions are included in their parent interface Iiocregistrar and Iiocresolver respectively .
Public interface Iiocmanager:iiocregistrar, Iiocresolver, IDisposable
{
///<summary>
/// Reference to the Castle Windsor Container.
</summary>
IWindsorContainer ioccontainer {get;}
<summary>
///Checks Whether given type is registered before.
</summary>
///<param name= "type" >type to check</param>
new bool isregistered (type type) ;
<summary>
///Checks Whether given type is registered before.
</summary>
///<typeparam name= "T" >type to check</typeparam>
new bool isregistered <T> ();
}
The class diagram of the Iiocregistrar class is as follows:
1.AddConventionalRegistrar,
2.RegisterAssemblyByConvention (Assembly Assembly),
3.RegisterAssemblyByConvention (Assembly Assembly, conventionalregistrationconfig config)
The above three methods require special attention:
The first method, Addconventionalregistrar, is to iocmanager a private generic collection list<iconventionaldependencyregistrar> registration mechanism, which is not very well understood is simply to set the injection mode of the dependency injection module,
It is usually invoked in the pre-initialization method of all the module classes to determine which types need to be registered (without calling if there is no).
For example, the Basicconventionalregistrar in the ABP assembly is to search for and register all of the implemented itransientdependency in the specified assembly. Isingletondependency and Iinterceptor classes and register them in the dependency container.
Second, the third method performs the true registration logic,
Typically called in the initialization method of a specific module, passing in the assembly to which the current module belongs.
The iteration list<iconventionaldependencyregistrar> registers the current assembly as a parameter,
Second, the third method differs in that the third method has a conventionalregistrationconfig parameter to decide whether to search for the current program and the Iwindsorinstaller implementation class in it to register, which is required by default.
The
Iabpmodulemanager is primarily used to manage all modules by default, which is a single assembly (a module corresponds to an assembly), and is primarily used to search for all module and their dependent module. First executes all the preinitialize methods of the module, executes all initialize, and finally executes all the postinitialize, The shutdown method for executing all the specific module is reversed sequentially when the shutdownmodules of the Iabpmodulemanager is executed.