Search code examples
c#neo4jneo4jclient

Returning dynamic properties - Neo4j Client


In my application I create a node based on properties supplied by the user e.g. I create a node of type Score (the type does not change) and properties such as TeamA, TeamB but those are dynamic (user can type whatever they want as property). How can I retrieve dynamic properties of that node later ? Neo4j client is forcing me to create a class of type Score with fixed properties e.g. .Return(score=> score.As<Score>().**FIXED_PROPERTY_NAME**); but I want to pass the name of dynamic property there e.g. TeamA, how can I achieve this ?


Solution

  • Short answer is that you can't do it the way you're trying to. As you said neo4jclient is strongly typed. You can get around this by passing the response yourself into a dynamic type in the same way as this answer: Casting nodes of an unknown type