赞
踩
官方文档没找见,自己在源码里面找到的
- 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;
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。