// --------------------------------------------------------------------------------------------------------------------------------------------------------- /// <summary> /// Changes the underlying definition to the specified one and propagate the necessary changes. /// </summary> public void ApplyRelationshipDefinitionChange(RelationshipDefinition NewDefinition) { var PreviousDefinitor = this.RelationshipDefinitor.Value; if (PreviousDefinitor.IsEqual(NewDefinition)) { return; } this.RelationshipDefinitor = NewDefinition.Assign(); foreach (var Linking in this.Links) { if (Linking.RoleDefinitor.RoleType == ERoleType.Origin) { Linking.RoleDefinitor = NewDefinition.OriginOrParticipantLinkRoleDef; } else { Linking.RoleDefinitor = NewDefinition.TargetLinkRoleDef; } Linking.RoleVariant = Linking.RoleDefinitor.AllowedVariants.FirstOrDefault(); } this.ApplyIdeaDefinitionChange(PreviousDefinitor); // Must be last, because updates graphics }
/// <summary> /// Constructor /// </summary> /// <param name="OwnerComposition">Composition owning this Relationship.</param> /// <param name="Definitor">Definitor of the Relationship.</param> /// <param name="Name">Name of the Relationship.</param> /// <param name="TechName">Technical Name of the Relationship.</param> /// <param name="Summary">Summary of the Relationship.</param> /// <param name="Pictogram">Image representing the Relationship.</param> public Relationship(Composition OwnerComposition, RelationshipDefinition Definitor, string Name, string TechName, string Summary = "", ImageSource Pictogram = null) : base(OwnerComposition, Name, TechName, Summary, Pictogram) { this.Links = new EditableList <RoleBasedLink>(__Links.TechName, this); this.RelationshipDefinitor = Definitor.Assign(); this.CompositeContentDomain = Definitor.CompositeContentDomain ?? Definitor.OwnerDomain; this.OwnerComposition.UsedDomains.AddNew(Definitor.OwnerDomain); }