private void CreateModules(ICollection <Type> moduleTypes, List <Type> plugInModuleTypes) { foreach (var moduleType in moduleTypes) { var moduleObject = _iocManager.Resolve(moduleType) as AbpModule; if (moduleObject == null) { throw new AbpInitializationException("This type is not an ABP module: " + moduleType.AssemblyQualifiedName); } moduleObject.IocManager = _iocManager; moduleObject.Configuration = _iocManager.Resolve <IAbpStartupConfiguration>(); var moduleInfo = new AbpModuleInfo(moduleType, moduleObject, plugInModuleTypes.Contains(moduleType)); _modules.Add(moduleInfo); if (moduleType == _modules.StartupModuleType) { StartupModule = moduleInfo; } Logger.DebugFormat("Loaded module: " + moduleType.AssemblyQualifiedName); } }
private void FillModules(Assembly assembly, List <Assembly> scannedAssemblies) { if (scannedAssemblies.Contains(assembly)) { return; } scannedAssemblies.Add(assembly); foreach (var type in assembly.GetTypes()) { //Skip types those are not Abp Module if (!AbpModuleHelper.IsAbpModule(type)) { continue; } //Prevent multiple adding same module var moduleInfo = _modules.FirstOrDefault(m => m.Type == type); if (moduleInfo == null) { moduleInfo = AbpModuleInfo.CreateForType(type); _modules.Add(moduleInfo); } //Check for depended modules var dependedModuleTypes = moduleInfo.Instance.GetDependedModules(); foreach (var dependedModuleType in dependedModuleTypes) { FillModules(dependedModuleType.Assembly, scannedAssemblies); } Logger.Debug("Loaded module: " + moduleInfo); } }
public void LoadAll() { Logger.Debug("Loading Abp modules..."); _modules.Add(AbpModuleInfo.CreateForType(typeof(AbpStartupModule))); var allAssemblies = AssemblyFinder.GetAllAssemblies(); var scannedAssemlies = new List <Assembly>(); foreach (var assembly in allAssemblies) { FillModules(assembly, scannedAssemlies); } SetDependencies(); Logger.DebugFormat("{0} modules loaded.", _modules.Count); }
private void CreateModules(ICollection<Type> moduleTypes) { foreach (var moduleType in moduleTypes) { var moduleObject = _iocManager.Resolve(moduleType) as AbpModule; if (moduleObject == null) { throw new AbpInitializationException("This type is not an ABP module: " + moduleType.AssemblyQualifiedName); } moduleObject.IocManager = _iocManager; moduleObject.Configuration = _iocManager.Resolve<IAbpStartupConfiguration>(); var moduleInfo = new AbpModuleInfo(moduleType, moduleObject); _modules.Add(moduleInfo); if (moduleType == _startupModuleType) { StartupModule = moduleInfo; } Logger.DebugFormat("Loaded module: " + moduleType.AssemblyQualifiedName); } }