Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8568795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:11:21+00:00 2026-06-11T18:11:21+00:00

Please bear with me I’m new to this: I’m currently using the .Net neo4jClient.

  • 0

Please bear with me I’m new to this:
I’m currently using the .Net neo4jClient. Currently I have a Share node and a Customer node. I’m creating a relationship CustomerOwnsShare between them and persisting it.

Here’s my Relationship class

public class CustomerOwnsShare :
    Relationship,
    IRelationshipAllowingSourceNode<Customer>,
    IRelationshipAllowingTargetNode<Share>
{
    public CustomerOwnsShare(NodeReference targetNode)
        : base(targetNode)
    {

    }

    public int Quantity { get; set; }
    public float CostPerShare { get; set; }
    public string DateOfPurchase { get; set; }
    public string ShareSymbol { get; set; }

    public const string TypeKey = "CUSTOMER_OWNS_SHARE";
    public override string RelationshipTypeKey
    {
        get { return TypeKey; }
    }
}

Now to retrieve a list of Relationships back from the Database I’m using Linq as below

IEnumerable<RelationshipInstance> relationshipInstances =
            graphClient.RootNode.In<Customer>(CustomerBelongsTo.TypeKey, c => c.Email == email)
            .OutE(CustomerOwnsShare.TypeKey)

But this returns me RelationshipInstance object which doesn’t have the data that i need(Quantity, CostPerShare, etc.).

RelationshipInstance exposes a RelationshipReference Object, but even that doesn’t help me retrieve my actual Relationship Object.
On digging a little deeper i see that i can execute Raw gremlin query as below

graphClient.ExecuteGetAllRelationshipsGremlin<>()

but the function signature of that also returns me an IEnumerable of RelationshipInstance.

Any ideas or suggestions on how i can retrieve my actual persisted Relationship object with it’s data ??

Thanks in Advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:11:23+00:00Added an answer on June 11, 2026 at 6:11 pm

    Sorry for the time to get this to you, what you actually want is a ‘RelationshipInstance<CustomerOwnsShare>‘…

    So, let’s pretend I have the following setup:

    Root(0) -[]-> User(1) -[CUSTOMER_OWNS_SHARE]-> MSFT(2)
    

    The numbers in brackets are the neo4j references.
    The query I would perform using neo4jclient is:

    var results = graphClient.ExecuteGetAllRelationshipsGremlin<CustomerOwnsShare>("g.v(2).inE", null);
    var quant = results[0].Data.Quantity; //etc
    

    Now, if you just copy / paste this, you’re going to get an error:

    'CustomerOwnsShare' must be a non-abstract type with a public parameterless constructor in order to use it as parameter 'TData' in the generic type or method 'Neo4jClient.GraphClient.ExecuteGetAllRelationshipsGremlin<TData>(string, System.Collections.Generic.IDictionary<string,object>)'
    

    Which is a pain, the way around this is to put a parameterless constructor into your CustomerOwnsShare class:

    [EditorBrowsable(EditorBrowsableState.Never)]
    public CustomerOwnsShare() : base(0) { }
    

    This is fine for you, as the TargetNode will be set by the deserialiser.
    You do want to make sure that you don’t use that constructor yourself though. The ‘EditorBrowsable’ will prevent external assemblies from seeing it, but unfortunately won’t do anything for any code in the same assembly, so you might want to mark it as:

    [Obsolete]
    

    as well, just to act as a reminder to yourself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please bear with me on this as I'm new to this. I have an
Please bear in mind that I'm totally new to Rails when answering this.My question
I'm new to iPad development so please bear with me. I have an iPad
I am new to iOS development so please bear with me. I have created
This is kinda confusing so please bear with me. I have an array (listOfStates)
I am very new to using preg_replace and such so please bear with me.
Please bear with me Silverlight Designer Gurus, this is compicated (to me). I'm creating
I'm a fairly new programmer so please bear with me on this. I am
Please bear with me, I am new to Uniscribe so I hope this isn't
Please bear with me -- I know this is complex. I have a table

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.