I am trying to understand as to why the neo4jClient throws an exception, hope someone here could help me better understand whats going on.
first of all the following code works!!
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");
but when I replace it with a different construct as below, it throws an exception
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");
I get an exception at the line where its trying to add a Where clause.
System.NotSupportedException: Unhandled node type MemberAccess in MemberExpression: value
detail of the stack trace is as follows
Neo4jClient.Cypher.CypherWhereExpressionVisitor.VisitMember(MemberExpression node) in c:\TeamCity\buildAgent\work\f1c4cf3efbf1b05e\Neo4jClient\Cypher\CypherWhereExpressionVisitor.cs: line 145 System.Linq.Expressions.MemberExpression.Accept(ExpressionVisitor visitor) System.Linq.Expressions.ExpressionVisitor.Visit(Expression node) Neo4jClient.Cypher.CypherWhereExpressionVisitor.VisitBinary(BinaryExpression node) in c:\TeamCity\buildAgent\work\f1c4cf3efbf1b05e\Neo4jClient\Cypher\CypherWhereExpressionVisitor.cs: line 65 System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor) System.Linq.Expressions.ExpressionVisitor.Visit(Expression node) 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 expression, 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: line 10 Neo4jClient.Cypher.CypherFluentQuery.Where[T1](Expression1 expression) in c:\TeamCity\buildAgent\work\f1c4cf3efbf1b05e\Neo4jClient\Cypher\CypherFluentQuery
Where.cs: line 34
Just curious to know what is the difference here & which of the 2 approach is a preferred way to query for performance reasons when boath works.
Regards Kiran