如何在 .net core API 中编写 Cypher 查询 [英] How to write Cypher query in .net core API

查看:73
本文介绍了如何在 .net core API 中编写 Cypher 查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类似的 Cypher 查询

I have a Cypher query like that

MATCH (n: learningPaths) 
WHERE any(x IN n.modules WHERE x = "any course")
RETURN n

如何在 .net core API 中编写此查询以获取结果

How can I write this query in .net core API to get the results

以前我有这样的查询

MATCH (n:learningPaths)-[]->(m:modules) 
WHERE m.id = "any course" 
RETURN n;

我在下面用 .net core API 写

and I write below in .net core API

var result = (
    await _graphClient.Cypher
          .Match(@"(n:learningPaths)-[]->(m:modules)")
          .Where<modules>(m => m.id == "any course")
          .Return((n)=>  n.As<learningPaths>())
          .ResultsAsync)
          .ToList();

推荐答案

你有没有试过这样做:

var query = client.Cypher
    .Match("MATCH (n:learningPaths)-->(m:modules)")
    .Where("any(x IN n.modules WHERE x = 'any course')"
    .Return( n => n.As<learningPaths>());

这篇关于如何在 .net core API 中编写 Cypher 查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆