Esempio n. 1
0
 /// <summary>
 /// Creates a new AbpModuleInfo object.
 /// </summary>
 /// <param name="instance"></param>
 public AbpModuleInfo(AbpModule instance)
 {
     Dependencies = new List<AbpModuleInfo>();
     Type = instance.GetType();
     Instance = instance;
     Assembly = Type.Assembly;
 }
Esempio n. 2
0
        /// <summary>
        /// 设置所有模块的依赖模块
        /// </summary>
        private void SetDependencies()
        {
            foreach (var moduleInfo in _modules)
            {
                moduleInfo.Dependencies.Clear();

                //Set dependencies for defined DependsOnAttribute attribute(s).
                foreach (var dependedModuleType in AbpModule.FindDependedModuleTypes(moduleInfo.Type))
                {
                    var dependedModuleInfo = _modules.FirstOrDefault(m => m.Type == dependedModuleType);
                    if (dependedModuleInfo == null)
                    {
                        throw new AbpInitializationException("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);
                    }
                }
            }
        }