Clone this wiki locally

Some Context

Neo4jClient just gives you a nice way to execute Cypher commands against a Neo4j instance. You always need to start with a working Cypher query, then you can write it in C#.

This page just shows some examples of how to translate different Cypher queries into C#.

For more explanation about how we handle parameters, immutable query objects, custom return clauses and things like that, you should really take the time to read the main Neo4jClient Cypher documentation that we have published. This page is just examples.

Neo4j Versions

Most of the examples on this page are written with Neo4j 2.0 in mind, so they skip the START clause, and use clauses like MERGE. The focus of this page is about Cypher-to-C# syntax though, and should be equally useful in helping you translate a Neo4j 1.9 query to C#.

At the end of the day, you always need to start with a working Cypher query, then work out the equivalent C#.

Note that we're using an explicitly named parameter (newUser) and the query, and the WithParam method to supply it. This keeps our encoding safe, protects against Cypher-injection attacks, and improves performance by allowing query plans to be cached.