试图在这样的查询中查看关系:
var query = _graph.Cypher.Start(
new
{
me = Node.ByIndexLookup("node_auto_index", "id", p.id)
}).Match("me-[r:FRIENDS_WITH]-friend")
.Where((Person friend) => friend.id == f.id)
.Return<FriendsWith>("r");
这是 FriendsWith 类。我无法为 FriendsWith 添加无参数构造函数,因为基类 (Relationship) 没有无参数构造函数。
public class FriendsWith : Relationship,
IRelationshipAllowingSourceNode<Person>,
IRelationshipAllowingTargetNode<Person>
{
public FriendsWith(NodeReference<Person> targetNode)
: base(targetNode)
{
__created = DateTime.Now.ToString("o");
}
public const string TypeKey = "FRIENDS_WITH";
public string __created { get; set; }
public override string RelationshipTypeKey
{
get { return TypeKey; }
}
}
但我收到错误“没有为此对象定义无参数构造函数”。当我尝试运行它时。返回查询关系的正确方法是什么?
堆栈跟踪
在 Neo4jClient.Deserializer.CypherJsonDeserializer 1.Deserialize(String content) in c:\TeamCity\buildAgent\work\f1c4cf3efbf1b05e\Neo4jClient\Deserializer\CypherJsonDeserializer.cs:line 53
at Neo4jClient.GraphClient.<>c__DisplayClass1d
1.b__1c(任务1 responseTask) in c:\TeamCity\buildAgent\work\f1c4cf3efbf1b05e\Neo4jClient\GraphClient.cs:line 793
at System.Threading.Tasks.ContinuationResultTaskFromResultTask
2.InnerInvoke() 在 System.Threading.Tasks.Task.Execute()