I am trying to use Neo4jClient to run Cypher syntax:
UNWIND {apples} AS newApple CREATE (a:Apple {newApple})
with a C # list of object List<Apple> a , where the object can be:
class Apple : Fruit { [JsonProperty(PropertyName = "Variety")] public String Variety { get; set; } }
I do not want to distribute the specifications of variable objects in different places around the code.
But the launch
graphClient.Cypher .Unwind(a, "newApple") .Create("(a: Apple {newApple})") .ExecuteWithoutResults()
throws:
Neo4jClient.NeoException: 'ParameterNotFoundException: expected parameter named newApple'
Change the Create line to
.Create("(a: Apple {Id: newApple.Id})")
seems to work, so the expected parameter newApple . The problem here is that if I change the properties of the class, I have to change the direct dependency in the cypher query string.
Questions
- Why is this? I would expect the identifier specified in
Unwind to be found in both cases. - Any workaround so that I can save generic code? I am trying to send any POCO object for automatic matching with parameters like neo node.
source share