private ModuleCollection CreateModules() { var modules = new ModuleCollection(); using (var scope = _container.BeginLifetimeScope()) { foreach (var moduleType in _container.ComponentRegistry.Registrations .Where(r => typeof(TypeModule).IsAssignableFrom(r.Activator.LimitType)) .Select(r => r.Activator.LimitType).Distinct()) { if (scope.Resolve(moduleType) is TypeModule module) { modules.Add(module); } } } modules.AddRange(_externalModules); return(modules); }
public virtual IModuleCollection TransformModuleCollection(IModuleCollection value) { IModule[] array = new IModule[value.Count]; for (int i = 0; i < value.Count; i++) { array[i] = this.TransformModule(value[i]); } IModuleCollection target = new ModuleCollection(); target.AddRange(array); return target; }