// Put this first so that MappingCustomizationModel.resx binds the resource name to the correct class
		/// <summary>
		/// Find or create the <see cref="MappingCustomizationModel"/> for the given <paramref name="store"/>
		/// </summary>
		/// <param name="store">The context <see cref="Store"/></param>
		/// <param name="forceCreate">Set to <see langword="true"/> to force a new customization model to
		/// be created if one does not already exist.</param>
		public static MappingCustomizationModel GetMappingCustomizationModel(Store store, bool forceCreate)
		{
			MappingCustomizationModel model = null;
			foreach (MappingCustomizationModel findModel in store.ElementDirectory.FindElements<MappingCustomizationModel>())
			{
				model = findModel;
				break;
			}
			if (model == null && forceCreate)
			{
				model = new MappingCustomizationModel(store);
			}
			return model;
		}
        // Put this first so that MappingCustomizationModel.resx binds the resource name to the correct class
        /// <summary>
        /// Find or create the <see cref="MappingCustomizationModel"/> for the given <paramref name="store"/>
        /// </summary>
        /// <param name="store">The context <see cref="Store"/></param>
        /// <param name="forceCreate">Set to <see langword="true"/> to force a new customization model to
        /// be created if one does not already exist.</param>
        public static MappingCustomizationModel GetMappingCustomizationModel(Store store, bool forceCreate)
        {
            MappingCustomizationModel model = null;

            foreach (MappingCustomizationModel findModel in store.ElementDirectory.FindElements <MappingCustomizationModel>())
            {
                model = findModel;
                break;
            }
            if (model == null && forceCreate)
            {
                model = new MappingCustomizationModel(store);
            }
            return(model);
        }
示例#3
0
		public static DslModeling::LinkedElementCollection<ReferenceModeNaming> GetReferenceModeNamingCollection(MappingCustomizationModel element)
		{
			return new DslModeling::LinkedElementCollection<ReferenceModeNaming>(element, ModelDomainRoleId);
		}
示例#4
0
		public static void SetModel(ReferenceModeNaming element, MappingCustomizationModel newModel)
		{
			DslModeling::DomainRoleInfo.SetLinkedElement(element, ReferenceModeNamingDomainRoleId, newModel);
		}
示例#5
0
		/// <summary>
		/// Constructor
		/// Creates a MappingCustomizationModelHasReferenceModeNaming link in the same Partition as the given MappingCustomizationModel
		/// </summary>
		/// <param name="source">MappingCustomizationModel to use as the source of the relationship.</param>
		/// <param name="target">ReferenceModeNaming to use as the target of the relationship.</param>
		public MappingCustomizationModelHasReferenceModeNaming(MappingCustomizationModel source, ReferenceModeNaming target)
			: base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(MappingCustomizationModelHasReferenceModeNaming.ModelDomainRoleId, source), new DslModeling::RoleAssignment(MappingCustomizationModelHasReferenceModeNaming.ReferenceModeNamingDomainRoleId, target)}, null)
		{
		}
示例#6
0
		public static DslModeling::LinkedElementCollection<AssimilationMapping> GetAssimilationMappingCollection(MappingCustomizationModel element)
		{
			return new DslModeling::LinkedElementCollection<AssimilationMapping>(element, ModelDomainRoleId);
		}
示例#7
0
		public static void SetModel(AssimilationMapping element, MappingCustomizationModel newModel)
		{
			DslModeling::DomainRoleInfo.SetLinkedElement(element, AssimilationMappingDomainRoleId, newModel);
		}
示例#8
0
文件: Tests.cs 项目: cjheath/NORMA
		public void Test5(Store store)
		{
			myTestServices.Compare(store, (MethodInfo)MethodInfo.GetCurrentMethod(), "FullyAbsorbed");

			myTestServices.LogMessage("Separate a one-to-main objectification");
			ORMModel model = store.ElementDirectory.FindElements<ORMModel>()[0];
			ObjectType birthObjectType = (ObjectType)model.ObjectTypesDictionary.GetElement("Birth").FirstElement;
			FactType factTypeToSeparate = birthObjectType.PreferredIdentifier.RoleCollection[0].Proxy.FactType;
			MappingCustomizationModel customizationModel;
			using (Transaction t = store.TransactionManager.BeginTransaction("Separate assimilated objectification"))
			{
				customizationModel = new MappingCustomizationModel(store);
				AssimilationMapping mapping = new AssimilationMapping(store, new PropertyAssignment(AssimilationMapping.AbsorptionChoiceDomainPropertyId, AssimilationAbsorptionChoice.Separate));
				new AssimilationMappingCustomizesFactType(mapping, factTypeToSeparate);
				mapping.Model = customizationModel;
				t.Commit();
			}
			myTestServices.Compare(store, (MethodInfo)MethodInfo.GetCurrentMethod(), "SeparateObjectification");

			myTestServices.LogMessage("Add a longer assimilation chain with a separate end point");
			ObjectType partyObjectType = (ObjectType)model.ObjectTypesDictionary.GetElement("Party").FirstElement;
			AssimilationMapping partyIsThingAssimilationMapping;
			using (Transaction t = store.TransactionManager.BeginTransaction("Longer assimilation chain"))
			{
				partyObjectType.ReferenceModeDisplay = ""; // Using ReferenceModeDisplay instead of ReferenceModeString to automatically kill Party_id
				ObjectType thingObjectType = new ObjectType(store, new PropertyAssignment(ObjectType.NameDomainPropertyId, "Thing"), new PropertyAssignment(ObjectType.IsIndependentDomainPropertyId, true));
				thingObjectType.Model = model;
				thingObjectType.ReferenceModeString = "id";
				SubtypeFact partyIsThingSubtypeFact = SubtypeFact.Create(partyObjectType, thingObjectType);
				partyIsThingAssimilationMapping = new AssimilationMapping(store, new PropertyAssignment(AssimilationMapping.AbsorptionChoiceDomainPropertyId, AssimilationAbsorptionChoice.Separate));
				new AssimilationMappingCustomizesFactType(partyIsThingAssimilationMapping, partyIsThingSubtypeFact);
				partyIsThingAssimilationMapping.Model = customizationModel;
				t.Commit();
			}

			myTestServices.Compare(store, (MethodInfo)MethodInfo.GetCurrentMethod(), "SeparateRemoteSupertype");

			myTestServices.LogMessage("Remove the remote separation");
			using (Transaction t = store.TransactionManager.BeginTransaction(""))
			{
				partyIsThingAssimilationMapping.AbsorptionChoice = AssimilationAbsorptionChoice.Absorb;
				t.Commit();
			}
		}