neo4jclient merge query cause unhandled exception

与世无争的帅哥 提交于 2019-12-24 13:57:13

问题


I want to use merge in my neo4jclient c# application, so I read this link and create a query like the below one :

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

But it crash and I don't know what I am missing.

Which part of my code is wrong?


回答1:


First define your tweet class:

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

Then try this statement like this:

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();


来源:https://stackoverflow.com/questions/32658527/neo4jclient-merge-query-cause-unhandled-exception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!