/// <summary> /// Create a connection between an ExternalConstraintShape and a FactType. Roles /// used in the connection are stored with the currently active connect action. /// </summary> /// <param name="sourceShapeElement">The source of the requested connection</param> /// <param name="targetShapeElement">The target of the requested connection</param> /// <param name="paintFeedbackArgs">PaintFeedbackArgs</param> public override void CreateConnection(ShapeElement sourceShapeElement, ShapeElement targetShapeElement, PaintFeedbackArgs paintFeedbackArgs) { SubtypeConnectAction action = (sourceShapeElement.Diagram as ORMDiagram).SubtypeConnectAction; ObjectType sourceObjectType; ObjectType targetObjectType; if ((null != (sourceObjectType = action.mySourceObjectType)) && (null != (targetObjectType = ObjectTypeFromShape(targetShapeElement)))) { SubtypeFact.Create(sourceObjectType, targetObjectType); } }
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(); } }