将 Neo4j 查询转换为 .Net
Conversion Neo4j query to .Net
我正在使用 Neo4jClient 将我的 Aspnet 应用程序连接到 Neo4j 数据库。
但是当我尝试转换此查询时遇到问题:
MATCH (person:Person)-[r_students]->(students:Person)
where person.personID = '{0}'
return students, r_students;
此代码:
_client.Cypher
.Match("(person:Person)-[r_students]->(students:Person)")
.Where(string.Format(@"person.personID = '{0}'", id))
.Return((students, r_students, person) => new TeacherStudents
{
Students = students.As<Person>(),
StudentsRelations = r_students.As<Supervised>(),
})
.Results;
我得到的错误是:
FormatException: Input string was not in a correct format.
错误的全部内容(很长)可以在这里找到
如何正确转换?
我建议你试试这个 Cypher:
graphClient.Cypher
.Match("(person:Person)-[r_students]->(students:Person)")
.Where("person.PersonID = {id}")
.WithParam("id", id)
.Return((students, r_students, person) => new TeacherStudents
{
Student = students.As<Person>(),
StudentsRel = r_students.As<Supervised>(),
})
.Results;
告诉我它是否有效。
我正在使用 Neo4jClient 将我的 Aspnet 应用程序连接到 Neo4j 数据库。 但是当我尝试转换此查询时遇到问题:
MATCH (person:Person)-[r_students]->(students:Person)
where person.personID = '{0}'
return students, r_students;
此代码:
_client.Cypher
.Match("(person:Person)-[r_students]->(students:Person)")
.Where(string.Format(@"person.personID = '{0}'", id))
.Return((students, r_students, person) => new TeacherStudents
{
Students = students.As<Person>(),
StudentsRelations = r_students.As<Supervised>(),
})
.Results;
我得到的错误是:
FormatException: Input string was not in a correct format.
错误的全部内容(很长)可以在这里找到
如何正确转换?
我建议你试试这个 Cypher:
graphClient.Cypher
.Match("(person:Person)-[r_students]->(students:Person)")
.Where("person.PersonID = {id}")
.WithParam("id", id)
.Return((students, r_students, person) => new TeacherStudents
{
Student = students.As<Person>(),
StudentsRel = r_students.As<Supervised>(),
})
.Results;
告诉我它是否有效。