public IModelRelationship GetOrAddRelationship(RelatedSymbolPair relatedSymbolPair) { using (_asyncLock.Lock()) { return(_modelService.LatestModel.TryGetRelationshipByPayload(relatedSymbolPair).Match( some => some, () => { var sourceNode = GetOrAddNode(relatedSymbolPair.SourceSymbol); var targetNode = GetOrAddNode(relatedSymbolPair.TargetSymbol); return _modelService.AddRelationship(sourceNode.Id, targetNode.Id, relatedSymbolPair.Stereotype, relatedSymbolPair); })); } }
public void AddRelationship(ModelNodeId sourceId, ModelNodeId targetId, ModelRelationshipStereotype?stereotype) { _modelService.AddRelationship(sourceId, targetId, stereotype ?? ModelRelationshipStereotype.Default); }