在一次查询中获取帖子、评论和用户Neo4j C#MVC5

在一次查询中获取帖子、评论和用户Neo4j C#MVC5,c#,model-view-controller,neo4j,cypher,neo4jclient,C#,Model View Controller,Neo4j,Cypher,Neo4jclient,我有以下课程 后cs 公共类职位:Neo4jEntity { 公职人员职位() { Label=“Post”; ID=Guid.NewGuid(); } 公共Guid ID{get;set;} 公共日期时间日期创建{get;set;} 公共字符串内容{get;set;} } Comment.cs 公共类注释:Neo4jEntity { 公众评论() { Label=“Comment”; ID=新Guid(); } 公共Guid ID{get;set;} 公共字符串内容{get;set;} 公共

我有以下课程

后cs

公共类职位:Neo4jEntity
{
公职人员职位()
{
Label=“Post”;
ID=Guid.NewGuid();
}
公共Guid ID{get;set;}
公共日期时间日期创建{get;set;}
公共字符串内容{get;set;}
}
Comment.cs

公共类注释:Neo4jEntity
{
公众评论()
{
Label=“Comment”;
ID=新Guid();
}
公共Guid ID{get;set;}
公共字符串内容{get;set;}
公共日期时间创建日期{get;set;}
}
ApplicationUser.cs

我想从数据库中获取所有添加了ApplicationUser注释的帖子。

var posts=\u graphClient.Cypher

.Match(((用户:ApplicationUser)-[:POST]->(posts)-[:HAS]->评论恐怕你需要更具体一些-什么不起作用?你有错误吗?你期望得到什么?你能在Neo4j管理页面中尝试
Cypher
并首先让它起作用吗?有一件事显然有点奇怪,那就是
Return(()=>Return.As)()
首先,它缺少一个结束符
第二,你需要把
Return.As(“此处的某物”)放进去
否则Neo4j不知道返回什么Hullo,我看到你做了一些更新-我只是注意到-抱歉-请随时发表评论让我知道。在你的示例视图代码中-你访问
Post
comment
类的
作者属性-但这两个都没有-这是
用户吗
/
users
您试图返回的字段?In-Post作者是添加帖子的单个用户。In-Comment也是向帖子添加评论的单个用户。是的,我也在尝试从查询返回此用户。
public class ApplicationUser:IdentityUser
        {
            public ApplicationUser()
            {
                Label = "ApplicationUser";
            }
            public string FirstName{ get; set; }
            public string SecondName{ get; set; }
            public Sex Sex{ get; set; }//enum


        }
 var posts = _graphClient.Cypher
                    .Match("(user:ApplicationUser)-[:POST]-> (posts)-[:HAS]->comments<-[:ADD]-(users)")
                    .Return(()=>Return.As<Post>("posts","comments","users"))
                    .Limit(50)
                    .Results.ToList();
foreach(var post in Model.Posts)
{
  <div>@post.DateCreation</div>
  <div>@post.Author.FirstName</div>
  <div>@post.Content</div>
  foreach(var comment in post.Comments)
  {
      <div>@comment.Author.Name</div>
      <div>@comment.Content</div>
  }

}