Ejemplo n.º 1
0
        void RemoveUnrelatedNodes(ModelMergedDifferenceInfo mergedDifference, IModelApplication application)
        {
            var mergedDifferenceViewId = mergedDifference.MergedViewId;
            var strategy        = mergedDifference.ModelMergedDifference.Strategy;
            var modelObjectView = application.Views[mergedDifferenceViewId].AsObjectView;

            RemoveUnrelatedNodesExceptViews(application);
            RemoveUnrelatedViewExceptDifferenceView(mergedDifferenceViewId, application.Views);
            RemoveStrategyUnrelatedNodes(modelObjectView, strategy);
            ClearViewAttributes(strategy, modelObjectView);
        }
Ejemplo n.º 2
0
        void CollectModulesDifferences(IEnumerable <ModelApplicationBase> modulesDifferences, ModelMergedDifferenceInfo mergedDifferenceInfo, Action <string, IModelApplication, ModelMergedDifferenceInfo> action)
        {
            var mergedViewId      = mergedDifferenceInfo.MergedViewId;
            var modelApplications = modulesDifferences.Cast <IModelApplication>().Where(application => application.Views[mergedViewId] != null);

            foreach (var modelApplication in modelApplications)
            {
                foreach (var modelView in modelApplication.Views.OfType <IModelObjectViewMergedDifferences>().Where(view
                                                                                                                    => view.Id == mergedViewId && view.MergedDifferences != null && view.MergedDifferences.Any()))
                {
                    foreach (var modelMergedDifference in modelView.MergedDifferences)
                    {
                        var id = modelMergedDifference.View.Id();
                        var modelMergedDifferenceInfo = new ModelMergedDifferenceInfo(mergedDifferenceInfo.ModelMergedDifference, id);
                        CollectModulesDifferences(modulesDifferences, modelMergedDifferenceInfo, action);
                    }
                }
                action(mergedViewId, modelApplication, mergedDifferenceInfo);
            }
        }
Ejemplo n.º 3
0
        static bool IsDifferenceValid(ModelMergedDifferenceInfo difference, IModelViews views)
        {
            var modelView = views[difference.MergedViewId] as IModelObjectView;

            return(modelView != null && modelView.ModelClass != null);
        }
Ejemplo n.º 4
0
        ModelApplicationBase CreateInheritanceLayer(ModelNode node, ModelApplicationBase applicationBase, ModelMergedDifferenceInfo mergedDifference, ModelApplicationBase master)
        {
            var modelApplication = node.CreatorInstance.CreateModelApplication();
            var targetViewId     = ((ModelNode)mergedDifference.TargetView).Id;

            modelApplication.Id = string.Format("{0}_" + applicationBase.Id, targetViewId);
            new ModelXmlReader().ReadFromModel(modelApplication, applicationBase);
            var application = ((IModelApplication)modelApplication);

            RemoveUnrelatedNodes(mergedDifference, application);
            application.Views[mergedDifference.MergedViewId].Id = targetViewId;


            var modelSources = ((IModelSources)application);

            modelSources.BOModelTypes      = ((IModelSources)master).BOModelTypes;
            modelSources.Modules           = ((IModelSources)master).Modules;
            modelSources.Controllers       = ((IModelSources)master).Controllers;
            modelSources.Localizers        = ((IModelSources)master).Localizers;
            modelSources.EditorDescriptors = new EditorDescriptors(((IModelSources)master).EditorDescriptors);
            return(modelApplication);
        }