I have some data stored as a neo4j node. This node has some property that is not described by the associated C# class, and thus is not automatically mapped back to the class when the neo4jclient query returns.
As an example, this C# class:
public class Node {
public string name;
public int number;
public CustomClass data;
}
stored in neo4j, then retrieved with the following neo4jclient fluent code:
var query = client.Cypher
.Match("(n:Node)")
.Return(n => n.As<Node>())
.Results;
will populate a Node object with name and number, but leave a null reference to the CustomClass object.
To solve this problem I have serialized the CustomClass as a JSON string, and stored it in neo4j as a string property. In order to deserialize this JSON class, I need to retrieve the JSON string property from the Node stored in neo4j.
The neo4jclient documentation recommends the following:
.Return(() => new {
JSONString = Return.As<string>("matchedNode.JSONProperties")
})
however this is invalid code. The Return
after JSONString =
does not exist in that context.
See Answer.
How can I get the JSONPropeties string out of the database?