Ejemplo n.º 1
0
        ModelApplicationBase BuildModel(XafApplication application, string configFileName, XpandApplicationModulesManager applicationModulesManager)
        {
            XpandModuleBase.CallMonitor.Clear();
            var modelAssemblyFile = typeof(XafApplication).Invoke(application, "GetModelAssemblyFilePath") as string;

            if (!File.Exists(modelAssemblyFile))
            {
                string example = @"
//Win
Path.Combine(Path.GetTempPath(),$""{GetType().Name}{ModelAssemblyFileName}"")

//Web
GetType().GetField(""sharedModelManager"", BindingFlags.NonPublic|BindingFlags.FlattenHierarchy|BindingFlags.Static)?.GetValue(this) == null
                ? Path.Combine(Path.GetTempPath(), $""{GetType().Name}{ModelAssemblyFileName}"") : null                    
";
                throw new FileNotFoundException(
                          $"The ModelEditor requires a valid ModelAssembly. Override the {application.GetType().FullName} GetModelAssemblyFilePath to provide a valid filename e.g.{example}");
            }

            applicationModulesManager.TypesInfo.AssignAsInstance();
            typeof(ModelApplicationCreator).SetFieldValue("fileModelAssembly", null);
            var modelApplication = ModelApplicationHelper.CreateModel(applicationModulesManager.TypesInfo,
                                                                      applicationModulesManager.DomainComponents, applicationModulesManager.Modules,
                                                                      applicationModulesManager.ControllersManager, application.ResourcesExportedToModel,
                                                                      GetAspects(configFileName), modelAssemblyFile, null);
            var modelApplicationBase = modelApplication.CreatorInstance.CreateModelApplication();

            modelApplicationBase.Id = "After Setup";
            ModelApplicationHelper.AddLayer(modelApplication, modelApplicationBase);
            return(modelApplication);
        }
Ejemplo n.º 2
0
        ModelApplicationBase BuildModel(XafApplication application, string configFileName, ApplicationModulesManager applicationModulesManager)
        {
            ModelApplicationBase modelApplication = ModelApplicationHelper.CreateModel(XpandModuleBase.TypesInfo, applicationModulesManager.DomainComponents, applicationModulesManager.Modules,
                                                                                       applicationModulesManager.ControllersManager, application.ResourcesExportedToModel, GetAspects(configFileName), null, null);
            var modelApplicationBase = modelApplication.CreatorInstance.CreateModelApplication();

            modelApplicationBase.Id = "After Setup";
            ModelApplicationHelper.AddLayer(modelApplication, modelApplicationBase);
            return(modelApplication);
        }
Ejemplo n.º 3
0
        ModelApplicationBase GetModelApplication(ApplicationModulesManager applicationModulesManager, PathInfo pathInfo, FileModelStore fileModelStore)
        {
            var modelApplication = ModelApplicationHelper.CreateModel(XafTypesInfo.Instance, applicationModulesManager.DomainComponents, applicationModulesManager.Modules, applicationModulesManager.ControllersManager, Type.EmptyTypes, fileModelStore.GetAspects(), null, null);

            AddLayers(modelApplication, applicationModulesManager, pathInfo);
            ModelApplicationBase lastLayer = modelApplication.CreatorInstance.CreateModelApplication();

            fileModelStore.Load(lastLayer);
            ModelApplicationHelper.AddLayer(modelApplication, lastLayer);
            return(modelApplication);
        }
Ejemplo n.º 4
0
        ModelApplicationBase BuildModel(XafApplication application, string configFileName, XpandApplicationModulesManager applicationModulesManager)
        {
            XpandModuleBase.CallMonitor.Clear();
//            var ruleBaseDescantans = RemoveRuntimeTypeFromIModelRuleBaseDescantans();
            var modelAssemblyFile = typeof(XafApplication).Invoke(application, "GetModelAssemblyFilePath") as string;

            applicationModulesManager.TypesInfo.AssignAsInstance();
            var modelApplication = ModelApplicationHelper.CreateModel(applicationModulesManager.TypesInfo, applicationModulesManager.DomainComponents, applicationModulesManager.Modules,
                                                                      applicationModulesManager.ControllersManager, application.ResourcesExportedToModel, GetAspects(configFileName), modelAssemblyFile, null);

            var modelApplicationBase = modelApplication.CreatorInstance.CreateModelApplication();

            modelApplicationBase.Id = "After Setup";
            ModelApplicationHelper.AddLayer(modelApplication, modelApplicationBase);
//            AddRuntimeTypesToIModelRuleBaseDescenants(ruleBaseDescantans);
            return(modelApplication);
        }
Ejemplo n.º 5
0
        ModelApplicationBase BuildModel(XafApplication application, string configFileName, XpandApplicationModulesManager applicationModulesManager)
        {
            XpandModuleBase.CallMonitor.Clear();
            var modelAssemblyFile = typeof(XafApplication).Invoke(application, "GetModelAssemblyFilePath") as string;

            if (!File.Exists(modelAssemblyFile))
            {
                throw new FileNotFoundException(
                          $"The ModelEditor requires a valid ModelAssembly. Reference the Xpand.ExpressApp.ModelDifference assembly in your front end project, override the {application.GetType().FullName} GetModelAssemblyFilePath to provide a valid filename using the call this.GetModelFilePath()");
            }

            applicationModulesManager.TypesInfo.AssignAsInstance();
            var modelApplication = ModelApplicationHelper.CreateModel(applicationModulesManager.TypesInfo,
                                                                      applicationModulesManager.DomainComponents, applicationModulesManager.Modules,
                                                                      applicationModulesManager.ControllersManager, application.ResourcesExportedToModel,
                                                                      GetAspects(configFileName), modelAssemblyFile, null);
            var modelApplicationBase = modelApplication.CreatorInstance.CreateModelApplication();

            modelApplicationBase.Id = "After Setup";
            ModelApplicationHelper.AddLayer(modelApplication, modelApplicationBase);
            return(modelApplication);
        }