尝试使用新的Neo4jClient 4.0.0.1预发行版本保存到neo4j DB

问题描述 投票:0回答:1

我正在使用https://www.nuget.org/packages/Neo4jClient/4.0.0.1-prerelease中的新neo4j客户端,现在我想使用类似https://github.com/Readify/Neo4jClient/wiki/cypher-examples中的参数>

在我的C#应用​​程序中,尝试保存新的节点Person with:

            public class Person
    {
        public string Name { get; set; }
        public int Id { get; set; } 
        public int Age { get; set; } 
    }

    private async Task SavePerson()
    {
        var client = new GraphClient(new Uri("http://localhost:7474/db/data/"), "neo4j", "neo4j");

        client.ConnectAsync();

        var father = new Person { Id = 1, Name = "Paul", Age = 45 };
        var mother = new Person { Id = 2, Name = "Julia", Age = 43 };

        await CreatePerson(client, father, mother);

    }

    private async Task CreatePerson(IGraphClient client, params Person[] persons)
    {
        client.Cypher
            .Unwind(persons, "person")
            .Merge("(p:Person { Id: person.Id })")
            .OnCreate()
            .Set("p = person")
            .ExecuteWithoutResultsAsync();
    }

我可以运行查询,但是我没有收到任何数据并且我没有收到任何错误,这里我缺少什么?

谢谢您和最诚挚的问候

我正在使用https://www.nuget.org/packages/Neo4jClient/4.0.0.1-prerelease中的新neo4j客户端,现在我想使用https://github.com/Readify/Neo4jClient/ Wiki / cypher -...

c# neo4j neo4jclient
1个回答
0
投票

您正在使用ExecuteWithoutResultsAsync方法执行查询,该方法不会返回结果(并且您的代码也不会尝试处理该方法的结果)。

© www.soinside.com 2019 - 2024. All rights reserved.