c# - Neo4jClient Node/Relationship Class conventions -


is there standard naming convention properties/methods of node/relationship class when working neo4jclient?

i'm following link neo4jclient - retrieving relationship cypher query create relationship class

however, there properties of relationship can't value despite relationship having it. while debugging code, realized properties not retrieved relationship when creating relationship object.

this relationship class

public class creates {     private string _raw;     private int _sourceport;     private string _image;     private int _destinationport;     private int _eventcode;     private string _name;     private string _src_ip;     private int _src_port;     private string _dvc;     private int _signature_id;     private string _dest_ip;     private string _computer;     private string _sourcetype;     private int _recordid;     private int _processid;     private datetime _time;     private int _dest_port;      public string raw { { return _raw; } set { _raw = value; } }     public int sourceport { { return _sourceport; } set { _sourceport = value; } }     public string image { { return _image; } set { _image = value; } }     public int destinationport { { return _destinationport; } set { _destinationport = value; } }     public int eventcode { { return _eventcode; } set { _eventcode = value; } }     public string name { { return _name; } set { _name = value; } }     public string src_ip { { return _src_ip; } set { _src_ip = value; } }     public int src_port { { return _src_port; } set { _src_port = value; } }     public string dvc { { return _dvc; } set { _dvc = value; } }     public int signature_id { { return _signature_id; } set { _signature_id = value; } }     public string dest_ip { { return _dest_ip; } set { _dest_ip = value; } }     public string computer { { return _computer; } set { _computer = value; } }     public string sourcetype { { return _sourcetype; } set { _sourcetype = value; } }     public int recordid { { return _recordid; } set { _recordid = value; } }     public int processid { { return _processid; } set { _processid = value; } }     public datetime indextime { { return _time; } set { _time = value; } }     public int dest_port { { return _dest_port; } set { _dest_port = value; } } } 

this class

public class processconnectedip {     public neo4jclient.relationshipinstance<pivot> bindto { get; set; }     public neo4jclient.node<logevent> bindip { get; set; }     public neo4jclient.relationshipinstance<pivot> connectto { get; set; }     public neo4jclient.node<logevent> connectip { get; set; } } 

this neo4jclient query relationship object

public ienumerable<processconnectedip> getconnectedips(string nodename)     {         try         {             var result =                   this.client.cypher.match("(sourcenode:process{name:{nameparam}})-[b:bind_ip]->(bind:ip_address)-[c:connect_ip]->(connect:ip_address)")                 .withparam("nameparam", nodename)                 .where("b.dest_ip = c.dest_ip")                 .andwhere("c.image=~{imageparam}")                 .withparam("imageparam", $".*" + nodename + ".*")                 .return((b, bind, c, connect) => new processconnectedip                 {                     bindto = b.as<relationshipinstance<creates>>(),                     bindip = bind.as<node<logevent>>(),                     connectto = c.as<relationshipinstance<creates>>(),                     connectip = connect.as<node<logevent>>()                 })                 .results;             return result;         }catch(exception ex)         {             console.writeline("getconnectedips: error msg: " + ex.message);             return null;         }     } 

this method read results

public void mymethod(string name)     {         ienumerable<processconnectedip> result = clientdal.getconnectedips(name);         if(result != null)         {             var results = result.tolist();             console.writeline(results.count());             foreach (processconnectedip item in results)             {                 console.writeline(item.data.src_ip);                 console.writeline(item.bindto.startnodereference.id);                 console.writeline(item.bindto.endnodereference.id);                 console.writeline(item.connectto.startnodereference.id);                 console.writeline(item.connectto.endnodereference.id);                  node<logevent> ans = item.bindip;                 logevent log = ans.data;                 console.writeline(log.name);                  node<logevent> ans1 = item.connectip;                 logevent log1 = ans1.data;                 console.writeline(log1.name);             }         }     } 

somehow, i'm able populate relationship object src_ip/src_port/dest_ip/dest_port values. rest empty.

is there possible reason why? i've played upper/lower cases on properties names not seem work.

this section of graph im working enter image description here

this relationship properties sample:

_raw: xml datasourceport: 49767image: c:\windows\explorer.exedestinationport: 443eventcode: 3name: bind ipsrc_ip: 172.10.10.104dvc: computer-namesrc_port: 49767signature_id: 3dest_ip: 172.10.10.11computer: computre-name_sourcetype: xmlwineventlog:microsoft-windows-sysmon/operationalrecordid: 13405621processid: 7184_time: 2017-08-28t15:15:39+08:00dest_port: 443

i'm not entirely sure how creates class ever populated, in particular fields - src_port property doesn't match src_port in sample provided (case wise).

i think it's best go super simple version. neo4jclient map properties properties in relationship long have same name (and case-sensitive).

so start new creates class (and use auto properties - it'll make life lot easier!)

public class creates {     public string computer { get; set; } } 

run query , see if result, keep on adding properties match name , type expect (int, string etc)


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -