private void CollectStuff(ITypesInfo typesInfo) { foreach (ModuleBase module in Modules) { Assembly assembly = module.GetType().Assembly; assemblyHash[assembly] = assembly; } foreach (Assembly assembly in assemblyHash.Keys) { typesInfo.LoadTypes(assembly); } _xpandControllersManager.CollectControllers(IsTypeFromModule); }
private XafApplication GetApplication(string executableName, ITypesInfo typesInfo) { string assemblyPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; try { ReflectionHelper.AddResolvePath(assemblyPath); var assembly = ReflectionHelper.GetAssembly(Path.GetFileNameWithoutExtension(executableName), assemblyPath); var assemblyInfo = typesInfo.FindAssemblyInfo(assembly); typesInfo.LoadTypes(assembly); var findTypeInfo = typesInfo.FindTypeInfo(typeof(XafApplication)); var findTypeDescendants = ReflectionHelper.FindTypeDescendants(assemblyInfo, findTypeInfo, false); return Enumerator.GetFirst(findTypeDescendants).CreateInstance(new object[0]) as XafApplication; } finally { ReflectionHelper.RemoveResolvePath(assemblyPath); } }