所以我一直在爲C#開發Neo4jClient庫,並且我對這兩個世界都很陌生。通用對象C#
我有這樣的POCO這裏:
public class SetEntity
{
public string GUID { get; set; }
public string Name { get; set; }
public string Type { get; set; }
public string CreatedDate { get; set; }
}
這個對象類在各種方法中,一個特別爲創建兩個節點之間的關係,但是我必須明確地說,這POCO是用於創建它IRelationshipAllowingSourceNode<SetEntity>
和IRelationshipAllowingTargetNode<EntityInstance>
。以下是處理該問題的整個課程。
class GraphRelationshipEntityInstanceToSetEntity : Relationship, IRelationshipAllowingSourceNode<EntityInstance>, IRelationshipAllowingTargetNode<SetEntity>
{
string RelationshipName;
public GraphRelationshipEntityInstanceToSetEntity(NodeReference targetNode)
: base(targetNode)
{
}
public GraphRelationshipEntityInstanceToSetEntity(string RelationshipName, NodeReference targetNode)
: base(targetNode)
{
this.RelationshipName = RelationshipName;
}
public override string RelationshipTypeKey
{
get { return RelationshipName; }
}
}
有沒有我可以通過<SetEntity>
或任何其他物體IRelationshipAllowingSourceNode<Object>
的方式。我認爲沒有必要爲與其他節點類型有關係的每個節點類型創建此類。
謝謝@Tim的確很有幫助! –