neo4jclient合并查询导致未处理的异常

时间:2015-09-18 18:14:08

标签: c# neo4j neo4jclient

我想在我的neo4jclient c#应用程序中使用merge,所以我读了this link并创建了如下所示的查询:

resultList.ForEach(
tweets => client.Cypher
    .Merge("(tweet:Tweet {newtweet})")
    .OnCreate()
    .Set("tweet = {newtweet}")
    .WithParams(new Tweets(tweets))
    .ExecuteWithoutResults());

但它崩溃了,我不知道我错过了什么。

我的代码中哪一部分错了?

1 个答案:

答案 0 :(得分:2)

首先定义你的推文类:

public class Tweet {
    public long StatusId { get; set; }
    public string Author { get; set; }
    public string Content { get; set; } 
}

然后尝试这样的声明:

var newTweet = new Tweet { StatusId = 2344
    , Author = "@AuthorName"
    , Content = "this is a tweet" };
graphClient.Cypher
    .Merge("(tweet:Tweet { StatusId: {id} })")
    .OnCreate()
    .Set("tweet = {newTweet}")
    .WithParams(new {
        id = newTweet.StatusId,
        newTweet
    })
    .ExecuteWithoutResults();