private static IModelRelationship CreateRelationship( ModelNodeId sourceId, ModelNodeId targetId, ModelRelationshipStereotype stereotype, [CanBeNull] object payload) { return(new ModelRelationship(ModelRelationshipId.Create(), sourceId, targetId, stereotype, payload)); }
private IModelRelationship CreateModelRelationship( [NotNull] string sourceNodeName, [NotNull] string targetNodeName, ModelRelationshipStereotype?stereotype = null) { var sourceNodeId = GetNodeIdByName(sourceNodeName); var targetNodeId = GetNodeIdByName(targetNodeName); return(new ModelRelationship(ModelRelationshipId.Create(), sourceNodeId, targetNodeId, stereotype ?? ModelRelationshipStereotype.Default)); }
public TestModelBuilder AddProperty(string typeName, string propertyName, string propertyTypeName) { var ownerTypeNode = GetNodeByName(typeName); var propertyNode = new PropertyNode(ModelNodeId.Create(), propertyName); ModelService.AddNode(propertyNode, ownerTypeNode); ModelService.AddItemToCurrentGroup(propertyNode); var propertyTypeNode = GetNodeByName(propertyTypeName); var association = new AssociationRelationship(ModelRelationshipId.Create(), propertyNode, propertyTypeNode); ModelService.AddRelationship(association); return(this); }
public static ModelRelationship CreateRoslynRelationship(IRoslynModelNode sourceNode, IRoslynModelNode targetNode, ModelRelationshipStereotype stereotype) { var id = ModelRelationshipId.Create(); if (stereotype == ModelRelationshipStereotypes.Inheritance) { return(new InheritanceRelationship(id, sourceNode, targetNode)); } if (stereotype == ModelRelationshipStereotypes.Implementation) { return(new ImplementationRelationship(id, sourceNode, targetNode)); } throw new InvalidOperationException($"Unexpected relationship type {stereotype.Name}"); }
private static IDiagramConnector CreateConnector( [NotNull] IImmutableSet <IDiagramNode> nodes, [NotNull] string sourceNodeName, [NotNull] string targetNodeName) { var sourceNode = nodes.Single(i => i.Name == sourceNodeName); var targetNode = nodes.Single(i => i.Name == targetNodeName); var relationshipName = $"{sourceNodeName}->{targetNodeName}"; var relationship = new ModelRelationship( ModelRelationshipId.Create(), sourceNode.Id, targetNode.Id, ModelRelationshipStereotype.Default, relationshipName); return(new DiagramConnector(relationship, ConnectorTypes.Dependency)); }
public IModelRelationship CreateRelationship(IModelNode source, IModelNode target, ModelRelationshipStereotype stereotype) { var id = ModelRelationshipId.Create(); if (stereotype == ModelRelationshipStereotype.Containment) { return(new ContainmentRelationship(id, source, target)); } if (stereotype == ModelRelationshipStereotypes.Implementation) { return(new ImplementationRelationship(id, source, target)); } if (stereotype == ModelRelationshipStereotypes.Inheritance) { return(new InheritanceRelationship(id, source, target)); } if (stereotype == ModelRelationshipStereotypes.Association) { return(new AssociationRelationship(id, source, target)); } throw new NotImplementedException($"Model relationship not implemented for stereotype {stereotype}"); }
private static ModelRelationship CreateContainsRelationship(ModelNodeId source, ModelNodeId target) { return(new ModelRelationship(ModelRelationshipId.Create(), source, target, ModelRelationshipStereotype.Containment)); }
public TestModelRelationship(IModelNode source, IModelNode target) : base(ModelRelationshipId.Create(), source, target, ModelRelationshipStereotype.Containment) { }
private void AddInheritance(IModelNode node, IModelNode baseNode) { var relationship = new InheritanceRelationship(ModelRelationshipId.Create(), node, baseNode); ModelService.AddRelationship(relationship); }
private void AddImplements(IModelNode node, IModelNode baseNode) { var relationship = new ImplementationRelationship(ModelRelationshipId.Create(), node, baseNode); ModelService.AddRelationship(relationship); }