c# - How to Separate NEO4J db Connection in Asp.net Core? -
in neo4j driver .net run queries should use below code
using (var driver = graphdatabase.driver("bolt://localhost:7687", authtokens.basic("neo4j", "neo4j"))) using (var session = driver.session()){ { var statementtemplate = "match (n:test {id:{id}}) return n.name test"; var statementparameters = new dictionary<string, object> { { "id", "121" } }; var statementresult = session.run(statementtemplate, statementparameters); console.writeline(record["test"].as<string>()); }
now want have code in class when want run queries call class , run query
i put graphdatabase.driver
in new method , call method in startup constructor
Comments
Post a Comment