neo4jclient where子句未放入参数
我在Where子句中遇到了一个问题,它没有提取值并将它们作为参数neo4jclient where子句未放入参数,neo4j,cypher,neo4jclient,Neo4j,Cypher,Neo4jclient,我在Where子句中遇到了一个问题,它没有提取值并将它们作为参数 return startingNode .StartCypher("startNode") .Match(matchQuery) .Where<TSourceNode>(otherStartNodes => otherStartNodes.Id != startingNode.Data.Id) .Return<TSourceNode>("
return
startingNode
.StartCypher("startNode")
.Match(matchQuery)
.Where<TSourceNode>(otherStartNodes => otherStartNodes.Id != startingNode.Data.Id)
.Return<TSourceNode>("otherStartNodes").Results;
返回
起始节点
.StartCypher(“startNode”)
.Match(匹配查询)
.Where(otherStartNodes=>otherStartNodes.Id!=startingNode.Data.Id)
.返回(“其他起始节点”)。结果;
查询字符串显示为“WHERE(Id)”。通过不使用lambdas,只使用下面的代码,我可以很容易地解决这个问题,但我很想知道为什么它不起作用
.Where("startNode.Id <> otherStartNodes.Id")
.Where(“startNode.Id其他startnodes.Id”)
我也试过下面这句话,但也没用
.Where<TSourceNode, TSourceNode>((otherStartNodes, startNode) => otherStartNodes.Id != startNode.Id)
.Where((其他StartNodes,startNode)=>otherStartNodes.Id!=startNode.Id)
编辑
塔瑟姆-我在Bitbucket中为此创建了一个问题
对于Where子句,您的方法是正确的
.Where<TSourceNode, TSourceNode>((otherStartNodes, startNode) => otherStartNodes.Id != startNode.Id))
.Where((其他startnodes,startNode)=>otherStartNodes.Id!=startNode.Id))
更新:这是在1.0.0.525及以上版本中修复的。
根据我对您的动态查询的理解,您提到的第三个选项(.Where((otherStartNodes,startNode)=>otherStartNodes.Id!=startNode.Id)
)是正确的
这应该行得通。我甚至在Neo4jClient中添加了更多的单元测试,以表明它确实:
你能解释一下为什么你认为它不起作用吗?生成的查询文本是什么
为
.Where(otherStartNodes=>otherStartNodes.Id!=startingNode.Data.Id)
获取的值是错误的。它应该在.NET中计算一次startingNode.Data.Id
,然后通过线路发送类似WHERE otherStartNodes.Id{p1}
。我将分别对此进行测试。当我使用“正确的一个”时,生成的查询文本生成了相同的“Where(Id)”。这个问题可能是因为TSourceNode是泛型类型,并且它没有正确地限定名称?我正在进行的项目是开源的,所以我将添加一个测试并通过链接发送给您。干杯