Thursday, January 3, 2013

c# - Neo4jClient create relationship with attribute and update it later ...

I have a Friend relationship class for Neo4jClient that I want to use for managing friends on my social networking website. Rather than create a separate relationship for each possible friend status, (requested, accepted, denied, blocked), I have added a property to my friend relationship class. However, when the class is serialized using Neo4jClient, it does not create the Status property on the relationship.

Here is my relationship class:

/// <summary> /// Friendship relationship - User is a friend of a User with a Status of REQUESTED, ACCEPTED, DENIED, BLOCKED /// </summary> public class Friend : Relationship, IRelationshipAllowingSourceNode<User>,     IRelationshipAllowingTargetNode<User> {     public static readonly string TypeKey = "FRIEND";      public string Status { get; set; }      public Friend(NodeReference targetNode)         : base(targetNode)     { }      public override string RelationshipTypeKey     {         get { return TypeKey; }     } } 

Here is my code for creating the relationship:

client.CreateRelationship(user, Friend(requestedUser) { Status = "REQUESTED" }); 

I want to be able to later query all Friend relationships and return different sets based on the Status property. I also want to be able to update the Status property on Friend relationships. Please advise on what should be done to properly add the Status property.

Source: http://stackoverflow.com/questions/14116568/neo4jclient-create-relationship-with-attribute-and-update-it-later

joran van der sloot honey badger critics choice awards 2012 colbert president huntingtons disease rob the firm

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.