using Neo4j.Driver;
...
private readonly IDriver _driver;
private readonly string _previousSessionBookmark;
...
public void PrintGreeting(string message)
{
using (ISession session =_driver.Session(
AccessMode.Write, _previousSessionBookmark))
{
using (ITransaction transaction = session.BeginTransaction())
{
Statement query = new Statement("CREATE (a:Greeting) SET a.message = $message RETURN a.message + ', from node ' + id(a)", new Dictionary<string, object>{{"message", message}});
IStatementResult result = transaction.Run(query);
transaction.Success(); // mark success, actually commit will happen in transaction.Dispose()
var greeting = result.Single()[0].As<string>();
Console.WriteLine(greeting);
}
_previousSessionBookmark = session.LastBookmark;
}
}