所以我有一个描述关系的类,如下所示:
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;
}
我确定这是一个微不足道的问题,但我将如何解决这个问题?