Exemple #1
0
        protected IModelApplication GetModelApplication(String[] designedDiffsXmls, String userDiffsXml)
        {
            ApplicationModelManager modelManager = GetApplicationModelManager(designedDiffsXmls);
            ModelApplicationBase    userLayer    = modelManager.CreateLayerByStore(ModelApplicationLayerIds.UserDiffs, new StringModelStore(userDiffsXml));

            return((IModelApplication)modelManager.CreateModelApplication(new ModelApplicationBase[] { userLayer }));
        }
Exemple #2
0
        public static ModelApplicationBase CreateModel(this ApplicationModulesManager manager,
                                                       IEnumerable <string> aspects, ModelStoreBase modelDifferenceStore = null)
        {
            ApplicationModelManager applicationModelManager = new ApplicationModelManager();

            var application           = manager.Application();
            var modelAssemblyFilePath = application.CallMethod("GetModelAssemblyFilePath") as string;

            applicationModelManager.Setup(XafTypesInfo.Instance, manager.DomainComponents, manager.Modules,
                                          manager.ControllersManager.Controllers,
                                          application.ResourcesExportedToModel, aspects, modelDifferenceStore, modelAssemblyFilePath);
            return(applicationModelManager.CreateModelApplication(new ModelApplicationBase[0]));
        }
Exemple #3
0
        private ApplicationModelManager GetApplicationModelManager(params String[] designedDiffsXmls)
        {
            ApplicationModelManager modelManager = new ApplicationModelManager();
            List <ModuleBase>       allModules   = new List <ModuleBase>(modules);

            if (needExtendModel)
            {
                allModules.Add(moduleWithModelInterfaceExtender);
            }
            for (int i = 0; i < designedDiffsXmls.Length; i++)
            {
                string     diffXml = designedDiffsXmls[i];
                StubModule moduleWithDifference = new StubModule();
                moduleWithDifference.SetDifference(diffXml);
                allModules.Add(moduleWithDifference);
            }
            modelManager.Setup(typesInfo, exportesTypes, allModules, controllers, Type.EmptyTypes, new String[0], null, null);
            return(modelManager);
        }
Exemple #4
0
        internal static IModelApplication CreateApplication(Type[] boModelTypes, Action <ITypesInfo>?customizeTypesInfo = null)
        {
            XafTypesInfo.HardReset();

            if (XafTypesInfo.Instance is TypesInfo typesInfo)
            {
                var store = typesInfo.FindEntityStore(typeof(NonPersistentTypeInfoSource));
                if (store is not null)
                {
                    foreach (var type in boModelTypes)
                    {
                        store.RegisterEntity(type);
                    }
                }
            }

            var modelManager = new ApplicationModelManager(null, true);

            var modules = new ModuleBase[]
            {
                new DXSystemModele(),
                new TestModule(boModelTypes, customizeTypesInfo)
            };

            foreach (var module in modules)
            {
                module.CustomizeTypesInfo(XafTypesInfo.Instance);
            }

            modelManager.Setup(
                XafTypesInfo.Instance,
                boModelTypes,
                modules,
                Enumerable.Empty <Controller>(),
                Enumerable.Empty <Type>(),
                Enumerable.Empty <string>(),
                null,
                null
                );

            return((IModelApplication)modelManager.CreateModelApplication(Enumerable.Empty <ModelApplicationBase>()));
        }
Exemple #5
0
        protected ModelApplicationCreator GetModelApplicationCreator(params String[] designedDiffsXmls)
        {
            ApplicationModelManager modelManager = GetApplicationModelManager(designedDiffsXmls);

            return(modelManager.DebugTest_GetCreator());
        }