国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 灵璧县| 西丰县| 黑水县| 鄂伦春自治旗| 缙云县| 安仁县| 会理县| 桐城市| 游戏| 安福县| 洛扎县| 霸州市| 于都县| 绿春县| 阿鲁科尔沁旗| 中宁县| 桦甸市| 昌邑市| 建瓯市| 鄱阳县| 无极县| 太白县| 中方县| 娱乐| 小金县| 临汾市| 遂溪县| 门源| 宜丰县| 清丰县| 金塔县| 疏附县| 河北区| 吐鲁番市| 彰武县| 鱼台县| 广昌县| 鲁甸县| 衢州市| 自治县| 凉城县|