官方文档没找见,自己在源码里面找到的
private string _dbHost = "bolt://localhost:7687";
private string _dbUser = "neo4j";
private string _dbPassword = "******";
private IDriver? _driver;
public CQLOperation(string _database = "neo4j")
{
this.database = _database;
}
public string database { get; set; }
public string ExcuteQuery(string Cql)
{
_driver = GraphDatabase.Driver(_dbHost, AuthTokens.Basic(_dbUser, _dbPassword));
using (var session = _driver.Session(o => o.WithDatabase(database)))
{
var res = session.ExecuteRead(work =>
{
return work.Run(Cql).ToList();
});
string res_str = JsonConvert.SerializeObject(res);
return res_str;
}
}