protected virtual void SetDependencies(List <RocketModuleDescriptor> modules, RocketModuleDescriptor module) { foreach (var dependedModuleType in RocketModuleHelper.FindDependedModuleTypes(module.Type)) { var dependedModule = modules.FirstOrDefault(m => m.Type == dependedModuleType); if (dependedModule == null) { throw new RocketException("Could not find a depended module " + dependedModuleType.AssemblyQualifiedName + " for " + module.Type.AssemblyQualifiedName); } module.AddDependency(dependedModule); } }
protected virtual void FillModules( List <RocketModuleDescriptor> modules, IServiceCollection services, Type startupModuleType, PlugInSourceList plugInSources) { // 从启动模块开始查找所有模块 foreach (var moduleType in RocketModuleHelper.FindAllModuleTypes(startupModuleType)) { modules.Add(CreateModuleDescriptor(services, moduleType)); } // 插件模块 foreach (var moduleType in plugInSources.GetAllModules()) { if (modules.Any(m => m.Type == moduleType)) { continue; } modules.Add(CreateModuleDescriptor(services, moduleType, isLoadedAsPlugIn: true)); } }