Displaying all 3 messages
Kenneth Ekman
8/23/2014 at 6:51
Hi,

In my C# based software I am using the immediate-family query to get a lot of information in as few queries as possible.


It works well, however, I have so far only to parsed the data coming in focus->nodes->profile-XXXXX while ignoring data in focus->nodes->union-XXXXX as my C# data structure has not allowed me to do so.

How do I create an IDictionary which can handle the case where any item in the nodes list can contain either a HttpPerson or a HttpPersonUnion object as below?


public class HttpGetIndividualResult
{
public HttpPerson focus { get; set; }
public IDictionary<string, ?????> nodes { get; set; }
}

public class HttpPerson
{
public string id { get; set; }
public string url { get; set; }
public bool @public { get; set; }
public bool is_alive { get; set; }
public string status { get; set; }
public string name { get; set; }
public string first_name { get; set; }
public string middle_name { get; set; }
public string maiden_name { get; set; }
public string last_name { get; set; }
public string display_name { get; set; }
public string gender { get; set; }
public string about_me { get; set; }
public HttpEvent birth { get; set; }
public HttpEvent death { get; set; }
public HttpMugshotUrls mugshot_urls { get; set; }
public IDictionary<string, HttpUnionRelation> edges { get; set; }
}

public class HttpPersonUnion
{
public string id { get; set; }
public string url { get; set; }
public string status { get; set; }
public IDictionary<string, HttpUnionRelation> edges { get; set; }
}

public class HttpUnionRelation
{
public string rel { get; set; }
}

Regards, Kenneth
Kenneth Ekman
8/24/2014 at 4:40
Just realized there was a sneaky (bordering on ugly) solution that could be used here...

Since the HttpPerson is a superset of the HttpPersonUnion I can use that one consistently...
Frode Evensen
9/17/2014 at 2:32
Hopefully you got it working, if not then this page has a lot of tips:
http://www.tamurajones.net/TheGeniModel.xhtml
rails-1a-000