问题
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