'How can I get started with Neo4jClient?

As the wiki docs are currently out of date, where can I get started? I have tried to get started with the out-of-date docs, but get some problems with the Async equivalents.



Solution 1:[1]

I'm looking at the docs and finding the same issue.

Tried some examples and they seem way out of date.

Solution 2:[2]

Here is an example using an async MS Test:

    [TestMethod]
    public async Task Neo4jClientAsyncCypherExampleTest()
    {
        var newUser = new User { Id = 456, Name = "Jim" };
        var graphClient = new BoltGraphClient(new Uri("neo4j://localhost:7687"), "neo4juser", "neo4jpassword");
        await graphClient.ConnectAsync();

        // Create the user - Note the change in using variables from {newUser} to $newUser
        await graphClient.Cypher
            .Create("(user:User $newUser)")
            .WithParam("newUser", newUser)
            .ExecuteWithoutResultsAsync();

        var results = await graphClient.Cypher
            .Match("(user:User)")
            .Where((User user) => user.Id == 456)
            .Return(user => user.As<User>())
            .ResultsAsync;

        Assert.AreEqual(newUser.Id, results.ToList().First().Id);
    }

This is using the sample User object and the Bolt Client which is the more performant interface. You'll probably have to adjust the username and password.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alex Ward
Solution 2