0

所以我有一个描述关系的类,如下所示:

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; }
        }
    }

现在我有一个方法,我想用它来创建上述类的实例,但我得到了这个The type arguments for method cannot be inferred from the usage错误。

这是方法:

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;
}

在此处输入图像描述

我确定这是一个微不足道的问题,但我将如何解决这个问题?

4

2 回答 2

1

看起来您正在尝试使用 Neo4jClient API 的过时部分来实现通用关系的通用实现。

使用密码。;)

于 2013-09-27T23:14:18.280 回答
1

所以我修好了,我NodeReferences需要是类型<TObject>

NodeReference<TObject> parentObjectReference = GetObjectReference(Id);

于 2013-09-27T12:31:14.750 回答