ApplicationModulesManager GetApplicationModulesManager(PathInfo pathInfo)
        {
            string assemblyPath         = Path.GetDirectoryName(pathInfo.AssemblyPath);
            var    designerModelFactory = new DesignerModelFactory();

            ReflectionHelper.Reset();
            XafTypesInfo.HardReset();
            XpoTypesInfoHelper.ForceInitialize();
            if (pathInfo.IsApplicationModel)
            {
                _currentDomainOnAssemblyResolvePathInfo = pathInfo;
                AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += CurrentDomainOnAssemblyResolve;
                AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainOnAssemblyResolve;
                var applicationInstance = Activator.CreateInstance(Assembly.Load(pathInfo.AssemblyPath).GetTypes().First(type => typeof(XafApplication).IsAssignableFrom(type)));
                AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve -= CurrentDomainOnAssemblyResolve;
                AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomainOnAssemblyResolve;
                _currentDomainOnAssemblyResolvePathInfo  = null;

                var configFileName = applicationInstance is WinApplication? pathInfo.AssemblyPath + ".config":Path.Combine(pathInfo.FullPath, "web.config");
                return(designerModelFactory.CreateModulesManager((XafApplication)applicationInstance, configFileName, Path.GetDirectoryName(pathInfo.AssemblyPath)));
            }
            var moduleFromFile = designerModelFactory.CreateModuleFromFile(pathInfo.AssemblyPath, assemblyPath);

            return(designerModelFactory.CreateModulesManager(moduleFromFile, pathInfo.AssemblyPath));
        }
예제 #2
0
        ApplicationModulesManager GetApplicationModulesManager(PathInfo pathInfo)
        {
            string assemblyPath         = Path.GetDirectoryName(pathInfo.AssemblyPath);
            var    designerModelFactory = new DesignerModelFactory();
            var    moduleFromFile       = designerModelFactory.CreateModuleFromFile(pathInfo.AssemblyPath, assemblyPath);

            return(designerModelFactory.CreateModulesManager(moduleFromFile, pathInfo.AssemblyPath));
        }
예제 #3
0
 ApplicationModulesManager GetApplicationModulesManager(PathInfo pathInfo) {
     string assemblyPath = Path.GetDirectoryName(pathInfo.AssemblyPath);
     var designerModelFactory = new DesignerModelFactory();
     var moduleFromFile = designerModelFactory.CreateModuleFromFile(pathInfo.AssemblyPath, assemblyPath);
     ReflectionHelper.Reset();
     XafTypesInfo.HardReset();
     XpoTypesInfoHelper.ForceInitialize();
     return designerModelFactory.CreateModulesManager(moduleFromFile, pathInfo.AssemblyPath);
 }
예제 #4
0
        ApplicationModulesManager GetApplicationModulesManager(PathInfo pathInfo)
        {
            var designerModelFactory = new DesignerModelFactory();

            ReflectionHelper.Reset();
            XafTypesInfo.HardReset();
            XpoTypesInfoHelper.ForceInitialize();
            if (pathInfo.IsApplicationModel)
            {
                var assembliesPath = Path.GetDirectoryName(pathInfo.AssemblyPath);
                var application    = designerModelFactory.CreateApplicationFromFile(pathInfo.AssemblyPath, assembliesPath);
                InitializeTypeInfoSources(application.Modules, assembliesPath);
                var applicationModulesManager = designerModelFactory.CreateModulesManager(application, null, assembliesPath);
                return(applicationModulesManager);
            }
            var moduleFromFile = designerModelFactory.CreateModuleFromFile(pathInfo.AssemblyPath, Path.GetDirectoryName(pathInfo.AssemblyPath));

            return(designerModelFactory.CreateModulesManager(moduleFromFile, pathInfo.AssemblyPath));
        }
예제 #5
0
        ApplicationModulesManager GetApplicationModulesManager(PathInfo pathInfo)
        {
            string assemblyPath         = Path.GetDirectoryName(pathInfo.AssemblyPath);
            var    designerModelFactory = new DesignerModelFactory();
            var    moduleFromFile       = designerModelFactory.CreateModuleFromFile(pathInfo.AssemblyPath, assemblyPath);

            ReflectionHelper.Reset();
            XafTypesInfo.HardReset();
            XpoTypesInfoHelper.ForceInitialize();
            return(designerModelFactory.CreateModulesManager(moduleFromFile, pathInfo.AssemblyPath));
        }
예제 #6
0
 ApplicationModulesManager GetApplicationModulesManager(PathInfo pathInfo) {
     string assemblyPath = Path.GetDirectoryName(pathInfo.AssemblyPath);
     var designerModelFactory = new DesignerModelFactory();
     var moduleFromFile = designerModelFactory.CreateModuleFromFile(pathInfo.AssemblyPath, assemblyPath);
     return designerModelFactory.CreateModulesManager(moduleFromFile, pathInfo.AssemblyPath);
 }