public void ExecuteOperation()
        {
            var chain = new TransactionChain();

            chain.TransactionCompleted += ChainOnTransactionCompleted;
            INode         newNode = MapManager.CreateNode(Map.DomainId, Map.RootMapId.Value, Node.Proxy.NodeType, string.Empty, ref chain);
            IRelationship newMapContainerRelationship = MapManager.CreateRelationship(Map.DomainId, Map.RootMapId.Value, MapContainerRelationshipType, string.Empty, ref chain);

            newMapContainerRelationship.ConnectNode(FromConnectionType, newNode, ref chain);
            newMapContainerRelationship.ConnectNode(ToConnectionType, Map, ref chain);

            newNode.Metadata.Add(newMapContainerRelationship, FromConnectionType, "XPosition", (Node.Location.X + 100).ToString(), ref chain);
            newNode.Metadata.Add(newMapContainerRelationship, FromConnectionType, "YPosition", (Node.Location.Y + 100).ToString(), ref chain);
            newNode.Metadata.Add(newMapContainerRelationship, FromConnectionType, "CollapseState", "None", ref chain);
            newNode.Metadata.Add(newMapContainerRelationship, FromConnectionType, "Visibility", "Visible", ref chain);


            foreach (var metadata in Node.Metadata)
            {
                if (!string.IsNullOrEmpty(metadata.Value.Value))
                {
                    newNode.Metadata.Add(null, null, metadata.Key, metadata.Value.Value, ref chain);
                }
            }
            Response = new InProcessTransactionResponse();
            Response.Nodes.Add(newNode);
            Response.Relationships.Add(newMapContainerRelationship);

            MapManager.ExecuteTransaction(chain);
        }
Beispiel #2
0
        public void ExecuteOperation()
        {
            CloneMap = new Dictionary <Node, INode>();
            var chain = new TransactionChain();

            chain.TransactionCompleted += ChainOnTransactionCompleted;
            Response = new InProcessTransactionResponse();
            foreach (var node in Nodes)
            {
                CloneMap.Add(node, BuildTransactionForNode(node, ref chain));
            }

            foreach (var relationship in Relationships)
            {
                BuildTransactionForRelationship(relationship, ref chain);
            }

            MapManager.ExecuteTransaction(chain);
        }
        public void ExecuteOperation()
        {
            var chain = new TransactionChain();

            chain.TransactionCompleted += ChainOnTransactionCompleted;
            INode         newNode = MapManager.CreateNode(Map.DomainId, Map.RootMapId.Value, NodeType, string.Empty, ref chain);
            IRelationship newMapContainerRelationship = MapManager.CreateRelationship(Map.DomainId, Map.RootMapId.Value, MapContainerRelationshipType, string.Empty, ref chain);

            newMapContainerRelationship.ConnectNode(FromConnectionType, newNode, ref chain);
            newMapContainerRelationship.ConnectNode(ToConnectionType, Map, ref chain);

            newNode.Metadata.Add(newMapContainerRelationship, FromConnectionType, "XPosition", X.ToString(), ref chain);
            newNode.Metadata.Add(newMapContainerRelationship, FromConnectionType, "YPosition", Y.ToString(), ref chain);
            newNode.Metadata.Add(newMapContainerRelationship, FromConnectionType, "CollapseState", "None", ref chain);
            newNode.Metadata.Add(newMapContainerRelationship, FromConnectionType, "Visibility", "Visible", ref chain);

            if (DefaultMetadata != null)
            {
                if (!DefaultMetadata.ContainsKey("Name"))
                {
                    newNode.Metadata.Add(null, null, "Name", string.Empty, ref chain);
                }
                foreach (var valuePair in DefaultMetadata)
                {
                    newNode.Metadata.Add(null, null, valuePair.Key, valuePair.Value, ref chain);
                }
            }
            else
            {
                newNode.Metadata.Add(null, null, "Name", string.Empty, ref chain);
            }

            Response = new InProcessTransactionResponse();
            Response.Nodes.Add(newNode);
            Response.Relationships.Add(newMapContainerRelationship);

            MapManager.ExecuteTransaction(chain);
        }