Example #1
0
 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);
     }
 }