Beispiel #1
0
        /// <summary>
        /// Creates a new AbpModuleInfo object.
        /// </summary>
        public ModuleInfo(Type type, BaseModule instance, bool isLoadedAsPlugIn)
        {
            Type             = type;
            Instance         = instance;
            IsLoadedAsPlugIn = isLoadedAsPlugIn;
            Assembly         = Type.GetTypeInfo().Assembly;

            Dependencies = new List <ModuleInfo>();
        }
Beispiel #2
0
        private List <Type> FindAllModuleTypes(out List <Type> plugInModuleTypes)
        {
            plugInModuleTypes = new List <Type>();

            var modules = BaseModule.FindDependedModuleTypesRecursivelyIncludingGivenModule(_modules.StartupModuleType);

            foreach (var plugInModuleType in _abpPlugInManager.PlugInSources.GetAllModules())
            {
                if (modules.AddIfNotContains(plugInModuleType))
                {
                    plugInModuleTypes.Add(plugInModuleType);
                }
            }

            return(modules);
        }
Beispiel #3
0
        private void SetDependencies()
        {
            foreach (var moduleInfo in _modules)
            {
                moduleInfo.Dependencies.Clear();

                //Set dependencies for defined DependsOnAttribute attribute(s).
                foreach (var dependedModuleType in BaseModule.FindDependedModuleTypes(moduleInfo.Type))
                {
                    var dependedModuleInfo = _modules.FirstOrDefault(m => m.Type == dependedModuleType);
                    if (dependedModuleInfo == null)
                    {
                        throw new InitializationException("Could not find a depended module " + dependedModuleType.AssemblyQualifiedName + " for " + moduleInfo.Type.AssemblyQualifiedName);
                    }

                    if ((moduleInfo.Dependencies.FirstOrDefault(dm => dm.Type == dependedModuleType) == null))
                    {
                        moduleInfo.Dependencies.Add(dependedModuleInfo);
                    }
                }
            }
        }