I am trying to use Neo4jClient to run the Cypher syntax:
UNWIND {apples} AS newApple
CREATE (a:Apple {newApple})
with a C# list of object List<Apple> a
where the object could be:
class Apple : Fruit
{
[JsonProperty(PropertyName = "Variety")]
public String Variety { get; set; }
}
I do not want to spread out object variable specs in different places around the code.
But running
graphClient.Cypher
.Unwind(a, "newApple")
.Create("(a: Apple {newApple})")
.ExecuteWithoutResults()
throws:
Neo4jClient.NeoException: 'ParameterNotFoundException: Expected a parameter named newApple'
Changing the Create
row to
.Create("(a: Apple {Id: newApple.Id})")
seems to work though, so the expected parameter newApple
is found. 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
would be found in both cases. - Any workaround so that I can keep the generalized code? I aim to be able to send in any POCO object to automatically match with neo node type params.