如何在windowform C#中的neo4jclient中使用like子句

时间:2016-03-16 10:13:40

标签: c# neo4jclient

我用neo4jclient查询数据,但我不知道如何使用like子句相同的SQL,现在它只是使用get specific

这里是完整代码

                  var client = new GraphClient(new Uri("http://localhost:7474/db/data"),   "username", "password");
                  client.Connect();
                  var apps = client.Cypher
                  .Match("(a:App)")
                  .Where("a.Name =~ {nameParam}")
                  .WithParam("nameParam", string.Format("'.*{0}.*'", nameapps))
                  .Return(a => a.As<APP>())
                  .Results;

                foreach (var application in apps)
                {

                    Console.WriteLine("APPID:{0} - AppName:{1}", application.ID, application.Name);

                }

1 个答案:

答案 0 :(得分:1)

您的Where变为:

.Where("a.Name =~ {nameParam}")
.WithParam("nameParam", $".*{nameapps}.*")

您还可以使用string.Format

.Where("a.Name =~ {nameParam}")
.WithParam("nameParam", string.Format(".*{0}.*", nameapps))

查看using Regex上有关Neo4j的文档以获取更多信息。