C# 无法从创建关系的使用错误中推断方法的类型参数
我有一个类,它描述了这样的关系:C# 无法从创建关系的使用错误中推断方法的类型参数,c#,generics,neo4jclient,C#,Generics,Neo4jclient,我有一个类,它描述了这样的关系: public class GraphRelationship<TObject> : Relationship<RelationshipObject>, IRelationshipAllowingSourceNode<TObject>, IRelationshipAllowingTargetNode<TObject> { string RelationshipName; pu
public class GraphRelationship<TObject> : Relationship<RelationshipObject>, IRelationshipAllowingSourceNode<TObject>, IRelationshipAllowingTargetNode<TObject>
{
string RelationshipName;
public GraphRelationship(string RelationshipName, NodeReference targetNode, RelationshipObject relationshipTypeObject)
: base(targetNode, relationshipTypeObject)
{
this.RelationshipName = RelationshipName;
}
public override string RelationshipTypeKey
{
get { return RelationshipName; }
}
}
我确信这是一个很小的问题,但是我该如何解决它呢?所以我解决了它,我的
节点引用需要是
类型
NodeReference parentObjectReference=GetObjectReference(Id)代码>看起来您正试图使用Neo4jClient API的过时部分来实现通用关系的通用实现
使用密码 API的哪些部分已经过时了,我们正在广泛地使用客户端。基本上,任何在代码路径中没有“密码”的东西。这与Neo4j本身的方向一致。本周,我将在旧金山的Neo办公室与其他驱动程序作者共度几天时间,届时我将花时间发布更好的指南。
public RelationshipReference CreateObjectRelationship(string relationshipType, string parentObjectId, string childObjectId, RelationshipObject relationshipProperties)
{
RelationshipReference relationshipReference = 0;
NodeReference parentNodeReference = GetObjectReference(parentObjectId);
NodeReference childNodeReference = GetObjectReference(childObjectId);
//This is where the error is
relationshipReference = GraphConnection.CreateRelationship(parentNodeReference, new GraphRelationship<RelationshipObject>(relationshipType, childNodeReference, relationshipProperties));
return relationshipReference;
}