国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

C#同步數(shù)據(jù)庫的數(shù)據(jù)到Neo4J

2019-11-14 13:58:17
字體:
供稿:網(wǎng)友

數(shù)據(jù)組件采用https://github.com/Readify/Neo4jClient

在nuget里面有

需要注意的是

 

以下是示例代碼:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Neo4jClient;
using Neo4jClient.Cypher;

namespace TestNeo4J
{
class PRogram
{
static void Main(string[] args)
{

// Init
var client = new GraphClient(new Uri("http:// client.Connect();

var root = client.Get<User>(new NodeReference(0)); //獲取根節(jié)點(diǎn),主要是在neoclipse工具里面好瀏覽,如不考慮瀏覽,你也可以不加到根節(jié)點(diǎn)里面去。

// Create entities
var refA = client.Create(new User() { Name = "User A" });
var refB = client.Create(new User() { Name = "User B" });
var refC = client.Create(new User() { Name = "User C" });

client.CreateRelationship(root.Reference,new ReferralRelationship(refA));
client.CreateRelationship(root.Reference, new ReferralRelationship(refB));
client.CreateRelationship(root.Reference, new ReferralRelationship(refC));


Console.Read();
}

//static void DrawPoints(
}
}

 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Neo4jClient;

namespace TestNeo4J
{

public class HatesData
{
public string Reason { get; set; }

public HatesData()
{ }

public HatesData(string reason)
{
this.Reason = reason;
}
}

public class KnowsRelationship : Relationship, IRelationshipAllowingSourceNode<User>,
IRelationshipAllowingTargetNode<User>
{
public static readonly string TypeKey = "KNOWS";

public KnowsRelationship(NodeReference targetNode)
: base(targetNode)
{ }

public override string RelationshipTypeKey
{
get { return TypeKey; }
}
}

public class ReferralRelationship : Relationship, IRelationshipAllowingSourceNode<User>,
IRelationshipAllowingTargetNode<User>
{
public static readonly string TypeKey = "Referral";

public ReferralRelationship(NodeReference targetNode)
: base(targetNode)
{ }

public override string RelationshipTypeKey
{
get { return TypeKey; }
}
}

public class User
{
public string Name { get; set; }
}
}


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 佛山市| 大方县| 黄龙县| 旅游| 河津市| 乳山市| 金沙县| 德昌县| 枣强县| 枣阳市| 剑阁县| 临沧市| 白山市| 蚌埠市| 玉田县| 河东区| 剑川县| 泗阳县| 克什克腾旗| 岑溪市| 云和县| 靖远县| 民权县| 伊宁市| 永济市| 镇宁| 浦东新区| 名山县| 隆回县| 三门峡市| 新兴县| 开阳县| 同江市| 张北县| 平南县| 六盘水市| 永清县| 乌鲁木齐县| 卓资县| 繁昌县| 中宁县|