-1

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.

GFeonix
  • 11

1 Answers1

0

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.