我试图了解为什么 neo4jClient 会引发异常,希望这里的人可以帮助我更好地了解发生了什么。
首先以下代码有效!
qry = qry.Start(new
{
city = Node.ByIndexLookup(model.City.IndexName, "Label", data.RegistredAddress.City),
state = Node.ByIndexLookup(model.State.IndexName, "Label", data.RegistredAddress.State),
country = Node.ByIndexLookup(model.Country.IndexName, "Label", data.RegistredAddress.Country),
});
qry = qry.Match("(city)-[:BELONGS_TO_STATE]->(state)-[:BELONGS_TO_COUNTRY]-(country)").Return<Node<model.City>>("city");
但是当我用下面的不同结构替换它时,它会引发异常
qry = qry.Start(new
{
city = Node.ByIndexLookup(model.City.IndexName, "Label", data.RegistredAddress.City),
});
qry = qry.Match("(city)-[:BELONGS_TO_STATE]->(state)-[:BELONGS_TO_COUNTRY]-(country)");
qry = qry.Where<model.State>(state => state.Label == data.RegistredAddress.State);
qry = qry.AndWhere<model.Country>(country => country.Label == data.RegistredAddress.Country);
var finalQry = qry.Return<Node<model.City>>("city");
我在尝试添加 Where 子句的行出现异常。
System.NotSupportedException: Unhandled node type MemberAccess in MemberExpression: value
堆栈跟踪的详细信息如下
Neo4jClient.Cypher.CypherWhereExpressionVisitor.VisitMember(MemberExpression 节点)在 c:\TeamCity\buildAgent\work\f1c4cf3efbf1b05e\Neo4jClient\Cypher\CypherWhereExpressionVisitor.cs:第 145 行 System.Linq.Expressions.MemberExpression.Accept(ExpressionVisitor 访问者)System.Linq。 Expressions.ExpressionVisitor.Visit(表达式节点) Neo4jClient.Cypher.CypherWhereExpressionVisitor.VisitBinary(BinaryExpression 节点)在 c:\TeamCity\buildAgent\work\f1c4cf3efbf1b05e\Neo4jClient\Cypher\CypherWhereExpressionVisitor.cs:第 65 行 System.Linq.Expressions.BinaryExpression。 Accept(ExpressionVisitor 访问者) System.Linq.Expressions.ExpressionVisitor.Visit(Expression 节点) System.Linq.Expressions.ExpressionVisitor.VisitLambda[T](Expression
1 node) System.Linq.Expressions.Expression
1.Accept(ExpressionVisitor visitor) System.Linq.Expressions.ExpressionVisitor.Visit(Expression node) Neo4jClient.Cypher.CypherWhereExpressionBuilder.BuildText(LambdaExpression 表达式, Func2 createParameterCallback) in c:\TeamCity\buildAgent\work\f1c4cf3efbf1b05e\Neo4jClient\Cypher\CypherWhereExpressionBuilder.cs: line 15 Neo4jClient.Cypher.CypherFluentQuery.<>c__DisplayClassd.<Where>b__c(QueryWriter w) in c:\TeamCity\buildAgent\work\f1c4cf3efbf1b05e\Neo4jClient\Cypher\CypherFluentQuery
Where.cs: line 11 Neo4jClient.Cypher.CypherFluentQuery.Mutate(Action1 callback) in c:\TeamCity\buildAgent\work\f1c4cf3efbf1b05e\Neo4jClient\Cypher\CypherFluentQuery.cs: line 40 Neo4jClient.Cypher.CypherFluentQuery.Where(LambdaExpression expression) in c:\TeamCity\buildAgent\work\f1c4cf3efbf1b05e\Neo4jClient\Cypher\CypherFluentQuery
Where.cs :第 10 行 Neo4jClient.Cypher.CypherFluentQuery.Where[T1](表达式1 expression) in c:\TeamCity\buildAgent\work\f1c4cf3efbf1b05e\Neo4jClient\Cypher\CypherFluentQuery
Where.cs:第 34 行
只是想知道这里有什么区别以及两种方法中的哪一种是在 boath 工作时查询性能原因的首选方法。
问候基兰