Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Neo4j-如何使用c#client cypher的WITH子句_C#_Neo4jclient - Fatal编程技术网

Neo4j-如何使用c#client cypher的WITH子句

Neo4j-如何使用c#client cypher的WITH子句,c#,neo4jclient,C#,Neo4jclient,我试图在C#neo4j客户机中使用WITH子句获得结果。 因为我是neo4j的新手,所以我不知道如何在C#中获得结果 请帮我提建议 MATCH (cs:CrawlerInfo) WITH cs, SIZE((cs)-[:CONTAINS]->()) as TotalResult RETURN cs.CrawlerName,cs.Keyword,cs.SearchType,toint(TotalResult),cs.CrawlerInfoDate order by toint(cs.Cra

我试图在C#neo4j客户机中使用WITH子句获得结果。
因为我是neo4j的新手,所以我不知道如何在C#中获得结果
请帮我提建议

MATCH (cs:CrawlerInfo)
WITH cs, SIZE((cs)-[:CONTAINS]->()) as TotalResult
RETURN 
cs.CrawlerName,cs.Keyword,cs.SearchType,toint(TotalResult),cs.CrawlerInfoDate
order by toint(cs.CrawlerId) desc

Neo4jClient
中,直接翻译是关键,应该可以通过API发现

//gc = GraphClient instance
//CrawlerInfo is a class
gc.Cypher
    .Match("(cs:CrawlerInfo)")
    .With("cs, SIZE( (cs)-[:CONTAINS]->() ) as TotalResult")
    .Return((cs, TotalResult) => new
    {
        CrawlerName = cs.As<CrawlerInfo>().CrawlerName,
        Keyword = cs.As<CrawlerInfo>().Keyword,
        SearchType = cs.As<CrawlerInfo>().SearchType,
        CrawlerInfoDate = cs.As<CrawlerInfo>().CrawlerInfoDate,
        Size = Return.As<int>("toint(TotalResult)")
    })
    .OrderByDescending("toint(cs.CrawlerId)");
那么您也不需要(不应该!)执行
toint
,这意味着您可以执行以下操作:

gc.Cypher
    .Match("(cs:CrawlerInfo)")
    .With("cs, SIZE( (cs)-[:CONTAINS]->() ) as TotalResult")
    .Return((cs, TotalResult) => new
    {
        CrawlerName = cs.As<CrawlerInfo>().CrawlerName,
        Keyword = cs.As<CrawlerInfo>().Keyword,
        SearchType = cs.As<CrawlerInfo>().SearchType,
        CrawlerInfoDate = cs.As<CrawlerInfo>().CrawlerInfoDate,
        Size = Return.As<int>("TotalResult")
    })
    .OrderByDescending("cs.CrawlerId");
其中,
CrawlerInfo
定义为:

public class CrawlerInfo
{
    public int CrawlerId { get; set;}
    public string CrawlerName { get; set; }
    public string Keyword { get; set; }
    public string SearchType { get; set; }
    public string CrawlerInfoDate { get; set;}
}

您使用的是
Neo4jClient
还是
Neo4j驱动程序
gc.Cypher
    .Match("(cs:CrawlerInfo)")
    .With("cs, SIZE((cs)-[:CONTAINS]->()) as TotalResult")
    .Return((cs, TotalResult) => new
    {
        CrawlerInfo = cs.As<CrawlerInfo>(),
        Size = Return.As<int>("TotalResult")
    })
    .OrderByDescending("cs.CrawlerId");
public class CrawlerInfo
{
    public int CrawlerId { get; set;}
    public string CrawlerName { get; set; }
    public string Keyword { get; set; }
    public string SearchType { get; set; }
    public string CrawlerInfoDate { get; set;}
}