Showing results for 
Search instead for 
Did you mean: 

Join the community at Nodes 2022, our free virtual event on November 16 - 17.

Tutorial for sending cypher queries from C#?

Node Link

I'm familiar with the ADO NET data provider for PostgreSQL (Npgsql). Using that driver, my C# code just sends SQL query strings and receives rows of results. I was surprised to find that there seems to be a lot of C# code necessary to issue a query to Neo4j, even though Cypher is concise. Could anyone suggest an up to date tutorial? I don't understand looks a bit more manageable but is not a complete example.


Graph Buddy

Hey @davideps

I've not used ADO.NET for a while now, but from memory, you have your IDbConnection, which you then use to create DataTables which are populated via queries with IDbParameter objects... The full flow (and naming obviously!) escapes me.

I've used both of the drivers you've picked there, and the reason there is more C# than with the ADO approach is largely down to things like the fundamental differences between a Graph Model and a Table based database.

I've been working on (and it's not complete yet) a project which demonstrates the official Driver vs. the Neo4jClient (and also an extension package for the official driver) here:

It's to show how each connector works - all the actual queries being executed are the same. I've tried to document the code - and there is supposed to be a set of posts about it later on - but I haven't finished - in the sense I've not added tests yet.

I have written about testing the Official driver here: and here: if that helps?

All the best


Node Link

Chris, thank you for such a quick and detailed reply. I'm finding helpful. For someone new to Neo4j, is there a reason to choose one client over the other?


Graph Buddy

Generally, it's what you are most comfortable using - the official driver is faster I would say, but requires more manual conversions etc -

The client uses the driver under the hoods for Bolt, but provides a (depending on you view) nicer way to get objects from it. The reason it's slower is down to the way it parses the objects back from the Driver.

You could use the client and you would still have access to the Driver if you wanted to use it:


Also - the Neo4j.Driver.Extensions package might make the Driver a bit easier to use.