コード例 #1
0
 private static IModelRelationship CreateRelationship(
     ModelNodeId sourceId,
     ModelNodeId targetId,
     ModelRelationshipStereotype stereotype,
     [CanBeNull] object payload)
 {
     return(new ModelRelationship(ModelRelationshipId.Create(), sourceId, targetId, stereotype, payload));
 }
コード例 #2
0
        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));
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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}");
        }
コード例 #5
0
        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));
        }
コード例 #6
0
        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}");
        }
コード例 #7
0
 private static ModelRelationship CreateContainsRelationship(ModelNodeId source, ModelNodeId target)
 {
     return(new ModelRelationship(ModelRelationshipId.Create(), source, target, ModelRelationshipStereotype.Containment));
 }
コード例 #8
0
 public TestModelRelationship(IModelNode source, IModelNode target)
     : base(ModelRelationshipId.Create(), source, target, ModelRelationshipStereotype.Containment)
 {
 }
コード例 #9
0
        private void AddInheritance(IModelNode node, IModelNode baseNode)
        {
            var relationship = new InheritanceRelationship(ModelRelationshipId.Create(), node, baseNode);

            ModelService.AddRelationship(relationship);
        }
コード例 #10
0
        private void AddImplements(IModelNode node, IModelNode baseNode)
        {
            var relationship = new ImplementationRelationship(ModelRelationshipId.Create(), node, baseNode);

            ModelService.AddRelationship(relationship);
        }