Beispiel #1
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public NoflyModuleInfo(Type type, NoflyModule instance)
 {
     Type         = type;
     Instance     = instance;
     Assembly     = Type.Assembly;
     Dependencies = new List <NoflyModuleInfo>();
 }
Beispiel #2
0
        private void SetDependencies()
        {
            foreach (var moduleInfo in _modules)
            {
                moduleInfo.Dependencies.Clear();

                //Set dependencies for defined DependsOnAttribute attribute(s).
                foreach (var dependedModuleType in NoflyModule.FindDependencyModules(moduleInfo.Type))
                {
                    var dependedModuleInfo = _modules.FirstOrDefault(m => m.Type == dependedModuleType);
                    if (dependedModuleInfo == null)
                    {
                        throw new Exception("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);
                    }
                }
            }
        }
Beispiel #3
0
        private List <Type> FindAllModules()
        {
            var modules = NoflyModule.FillAllModules(_startupModuleType);

            return(modules);
        }