Used by ModuleInitializer to get the load sequence for the modules to load according to their dependencies.
Пример #1
0
        /// <summary>
        /// Checks for cyclic dependencies, by calling the dependencysolver.
        /// </summary>
        /// <param name="modules">the.</param>
        /// <returns></returns>
        protected static string[] SolveDependencies(IEnumerable <ModuleInfo> modules)
        {
            if (modules == null)
            {
                throw new System.ArgumentNullException("modules");
            }

            ModuleDependencySolver solver = new ModuleDependencySolver();

            foreach (ModuleInfo data in modules)
            {
                solver.AddModule(data.ModuleName);

                if (data.DependsOn != null)
                {
                    foreach (string dependency in data.DependsOn)
                    {
                        solver.AddDependency(data.ModuleName, dependency);
                    }
                }
            }

            if (solver.ModuleCount > 0)
            {
                return(solver.Solve());
            }

            return(new string[0]);
        }
Пример #2
0
 public void Setup()
 {
     solver = new ModuleDependencySolver();
 }