Exemple #1
0
        public ModelApplicationBase GetModel(ModelApplicationBase master)
        {
            if (!master.IsMaster)
            {
                throw new ArgumentException("IsNotMaster", "master");
            }
            if (master.LastLayer.Id != "After Setup")
            {
                throw new ArgumentException("master.LastLayer", master.LastLayer.Id);
            }
            Guard.ArgumentNotNull(Name, "Name");
            var layer = master.CreatorInstance.CreateModelApplication();

            layer.Id = Name;
            master.AddLayerBeforeLast(layer);
            var modelXmlReader = new ModelXmlReader();

            foreach (var aspectObject in AspectObjects)
            {
                if (!(string.IsNullOrEmpty(aspectObject.Xml)))
                {
                    modelXmlReader.ReadFromString(layer, GetAspectName(aspectObject), aspectObject.Xml);
                }
            }
            _currentModel = layer;

            return(layer);
        }
Exemple #2
0
        Dictionary <string, ModelDifferenceObjectInfo> CreateNew(ModelApplicationBase model)
        {
            var modelDifferenceObjectInfos = new Dictionary <string, ModelDifferenceObjectInfo>();
            var application = model.CreatorInstance.CreateModelApplication();

            application.Id = Application.Title;
            model.AddLayerBeforeLast(application);
            var modelDifferenceObject     = ObjectSpace.CreateObject <ModelDifferenceObject>().InitializeMembers(application.Id, Application);
            var modelDifferenceObjectInfo = new ModelDifferenceObjectInfo(modelDifferenceObject, application);

            modelDifferenceObjectInfos.Add(application.Id, modelDifferenceObjectInfo);
            return(modelDifferenceObjectInfos);
        }
Exemple #3
0
        Dictionary <string, ModelDifferenceObjectInfo> CreateNew(ModelApplicationBase model)
        {
            var modelDifferenceObjectInfos = new Dictionary <string, ModelDifferenceObjectInfo>();
            var application = CreateModelApplication(model, DifferenceType);

            model.AddLayerBeforeLast(application);
            var modelDifferenceObject = ObjectSpace.CreateObject <ModelDifferenceObject>().InitializeMembers(application.Id, Application);

            CreateUserModelDifferenceXPObjectType();
            var modelDifferenceObjectInfo = new ModelDifferenceObjectInfo(modelDifferenceObject, application);

            modelDifferenceObjectInfos.Add(application.Id, modelDifferenceObjectInfo);
            return(modelDifferenceObjectInfos);
        }
        Dictionary<string, ModelDifferenceObjectInfo> GetLoadedModelDifferenceObjectInfos(ModelApplicationBase model) {
            Dictionary<string, ModelDifferenceObjectInfo> loadedModelDifferenceObjectInfos = GetLoadedModelApplications(model);

            if (loadedModelDifferenceObjectInfos.Count() == 0) {
                var modelDifferenceObjectInfos = new Dictionary<string, ModelDifferenceObjectInfo>();
                var application = model.CreatorInstance.CreateModelApplication();
                application.Id = XpandModuleBase.Application.Title;
                model.AddLayerBeforeLast(application);
                var modelDifferenceObject = ObjectSpace.CreateObject<ModelDifferenceObject>().InitializeMembers(application.Id);
                modelDifferenceObjectInfos.Add(application.Id, new ModelDifferenceObjectInfo(modelDifferenceObject, application));
                loadedModelDifferenceObjectInfos = modelDifferenceObjectInfos;
            }
            return loadedModelDifferenceObjectInfos;
        }
Exemple #5
0
        void CreateResourceRoleModels(ResourcesLayerBuilder resourcesLayerBuilder, Dictionary <string, ModelDifferenceObjectInfo> loadedModelDifferenceObjectInfos, ModelApplicationBase model)
        {
            var roleMarker = CreateModelApplication(model, DifferenceType.Role, DeviceCategory.All);

            roleMarker.Id = "RoleMarker";
            model.AddLayerBeforeLast(roleMarker);
            resourcesLayerBuilder.AddLayers(RoleApplicationPrefix, loadedModelDifferenceObjectInfos, model);
            var lastLayer = model.LastLayer;

            while (model.LastLayer.Id != "RoleMarker")
            {
                ModelApplicationHelper.RemoveLayer(model);
            }
            ModelApplicationHelper.RemoveLayer(model);
            ModelApplicationHelper.AddLayer(model, lastLayer);
        }
        public ModelApplicationBase GetModel(ModelApplicationBase master) {
            if (!master.IsMaster) {
                throw new ArgumentException("IsNotMaster", "master");
            }
            if (master.LastLayer.Id != "After Setup")
                throw new ArgumentException("master.LastLayer", master.LastLayer.Id);
            Guard.ArgumentNotNull(Name, "Name");
            var layer = master.CreatorInstance.CreateModelApplication();
            layer.Id = Name;
            master.AddLayerBeforeLast(layer);
            var modelXmlReader = new ModelXmlReader();
            foreach (var aspectObject in AspectObjects) {
                if (!(string.IsNullOrEmpty(aspectObject.Xml)))
                    modelXmlReader.ReadFromString(layer, GetAspectName(aspectObject), aspectObject.Xml);
            }
            _currentModel = layer;

            return layer;
        }
Exemple #7
0
        Dictionary <string, ModelDifferenceObjectInfo> CreateNew(ModelApplicationBase model, DeviceCategory deviceCategory)
        {
            if (((IModelOptionsModelDifference)model.Application.Options).ModelUpdateMode == ModelUpdateMode.Never)
            {
                throw new NotSupportedException($"You cannot create a new application model while {nameof(IModelOptionsModelDifference.ModelUpdateMode)}={ModelUpdateMode.Never}");
            }
            var modelDifferenceObjectInfos = new Dictionary <string, ModelDifferenceObjectInfo>();
            var application = CreateModelApplication(model, DifferenceType, deviceCategory);

            model.AddLayerBeforeLast(application);
            var modelDifferenceObject = ObjectSpace.CreateObject <ModelDifferenceObject>().InitializeMembers(Application.Title, Application, deviceCategory);

            modelDifferenceObject.CreateAspectsFromPath(Application.GetDiffDefaultName(PathHelper.GetApplicationFolder()));
            CreateUserModelDifferenceXPObjectType();
            var modelDifferenceObjectInfo = new ModelDifferenceObjectInfo(modelDifferenceObject, application);

            modelDifferenceObjectInfos.Add(application.Id, modelDifferenceObjectInfo);
            return(modelDifferenceObjectInfos);
        }
 Dictionary<string, ModelDifferenceObjectInfo> CreateNew(ModelApplicationBase model) {
     var modelDifferenceObjectInfos = new Dictionary<string, ModelDifferenceObjectInfo>();
     var application = CreateModelApplication(model, DifferenceType);
     model.AddLayerBeforeLast(application);
     var modelDifferenceObject = ObjectSpace.CreateObject<ModelDifferenceObject>().InitializeMembers(application.Id, Application);
     CreateUserModelDifferenceXPObjectType();
     var modelDifferenceObjectInfo = new ModelDifferenceObjectInfo(modelDifferenceObject, application);
     modelDifferenceObjectInfos.Add(application.Id, modelDifferenceObjectInfo);
     return modelDifferenceObjectInfos;
 }
 void CreateResourceRoleModels(ResourcesLayerBuilder resourcesLayerBuilder, Dictionary<string, ModelDifferenceObjectInfo> loadedModelDifferenceObjectInfos, ModelApplicationBase model) {
     var roleMarker = CreateModelApplication(model,DifferenceType.Role);
     roleMarker.Id = "RoleMarker";
     model.AddLayerBeforeLast(roleMarker);
     resourcesLayerBuilder.AddLayers(RoleApplicationPrefix, loadedModelDifferenceObjectInfos, model);
     var lastLayer = model.LastLayer;
     while (model.LastLayer.Id != "RoleMarker") {
         ModelApplicationHelper.RemoveLayer(model);
     }
     ModelApplicationHelper.RemoveLayer(model);
     ModelApplicationHelper.AddLayer(model, lastLayer);
 }
 Dictionary<string, ModelDifferenceObjectInfo> CreateNew(ModelApplicationBase model) {
     var modelDifferenceObjectInfos = new Dictionary<string, ModelDifferenceObjectInfo>();
     var application = CreateModelApplication(model, DifferenceType);
     
     
     model.AddLayerBeforeLast(application);
     var modelDifferenceObject = ObjectSpace.CreateObject<ModelDifferenceObject>().InitializeMembers(application.Id, Application);
     if (Application is ServerApplication) {
         var xpObjectType = ObjectSpace.CreateObject<XPObjectType>();
         xpObjectType.TypeName = typeof(UserModelDifferenceObject).FullName;
         xpObjectType.AssemblyName = typeof(UserModelDifferenceObject).Assembly.GetName().Name;
     }
     var modelDifferenceObjectInfo = new ModelDifferenceObjectInfo(modelDifferenceObject, application);
     modelDifferenceObjectInfos.Add(application.Id, modelDifferenceObjectInfo);
     return modelDifferenceObjectInfos;
 }