Friday, 27 September 2013

The type arguments for method cannot be inferred from the usage error for creating a relationship

The type arguments for method cannot be inferred from the usage error for
creating a relationship

So I have a class that describes the Relationship like so:
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; }
}
}
Now I have a method that I want to use to create an instance of the above
mentioned class, but I get this The type arguments for method cannot be
inferred from the usage error.
Here is the method:
public RelationshipReference CreateObjectRelationship(string
relationshipType, string parentObjectId, string childObjectId,
RelationshipObject relationshipProperties)
{
RelationshipReference relationshipReference = 0;
NodeReference parentNodeReference = GetObjectReference(parentObjectId);
NodeReference childNodeReference = GetObjectReference(childObjectId);
relationshipReference =
GraphConnection.CreateRelationship(parentNodeReference, new
GraphRelationship<RelationshipObject>(relationshipType,
childNodeReference, relationshipProperties));
return relationshipReference;
}
Im sure this is a trivial problem, but how would i fix this?

No comments:

Post a Comment