Пример #1
0
        public SitecoreNode CreateNode(SitecoreNode node)
        {
            _graphClient.Connect();

            var newNode = _graphClient.Cypher
                .Create("(item:Item {node})")
                .WithParam("node", node)
                .Return<SitecoreNode>("item")
                .Results.FirstOrDefault();

            return newNode;
        }
Пример #2
0
        public RelationshipReference CreateRelationship(SitecoreNode sourceNode, string relationship, SitecoreNode targetNode)
        {
            //var client = CreateGraphClient();

            _graphClient.Connect();

            _graphClient.Cypher
                .Match("(item1:Item)", "(item2:Item)")
                .Where((SitecoreNode item1) => item1.Uri == sourceNode.Uri)
                .AndWhere((SitecoreNode item2) => item2.Uri == targetNode.Uri)
                .Merge("item1-[:" + relationship + "]->item2")
                .ExecuteWithoutResults();

            return null;
        }