Esempio n. 1
0
        private string GenerateRelationship(CreateAndSearchRelationship relationship)
        {
            var scriptBuilder = new StringBuilder();

            scriptBuilder.Append('(').Append(relationship.Node1.Id).Append(")-[");

            scriptBuilder.Append(GetLabels(relationship.Labels));

            if (relationship.Properties.Any())
            {
                scriptBuilder.Append(GetProperties(relationship.Properties));
            }

            scriptBuilder.Append("]->(").Append(relationship.Node2.Id).Append(")");

            return(scriptBuilder.ToString());
        }
Esempio n. 2
0
        public string CreateAndSearch(CreateAndSearchRelationship relationship)
        {
            var scriptBuilder = new StringBuilder();

            if (string.IsNullOrEmpty(relationship.Node1.Id))
            {
                relationship.Node1.Id = "n1";
            }
            if (string.IsNullOrEmpty(relationship.Node2.Id))
            {
                relationship.Node2.Id = "n2";
            }

            scriptBuilder.Append("MATCH ").Append(GenerateNode(relationship.Node1)).Append(", ").AppendLine(GenerateNode(relationship.Node2)).Append(CREATE).Append(GenerateRelationship(relationship));

            return(scriptBuilder.ToString());
        }