在 .NET 生态适配方面,Neo4j 拥有远为成熟的工具链——官方 Neo4j.Driver(Bolt 协议)、社区驱动的 Neo4jClient(流畅 Cypher API)、Neo4j-OGM 对象图映射器 , Spring Data Neo4j (有 .NET 移植) Blueprint41 提供类似能力[101] Neo4j OGM 功能更全 LINQ 集成 Neo4jClient 支持 LINQ 风格查询 深度解析 Neo4jClient 是 .NET 生态中连接 Neo4j(及 Memgraph)最流行的客户端库,由社区维护,GitHub 上获得广泛采用[104]。 其核心特性包括: 流畅 Cypher API: using Neo4jClient; var client = new BoltGraphClient("neo4j://localhost:7687" 但需要注意:Memgraph 不支持 Neo4j 的 APOC 存储过程调用,因此依赖 APOC 的 Neo4jClient 代码需要改写。
基于 Neo4jClient 的 ID 生成器 @Component class MyIdGenerator implements IdGenerator<String> { private final Neo4jClient neo4jClient; public MyIdGenerator(Neo4jClient neo4jClient) { this.neo4jClient = neo4jClient; } @Override public String generateId(String
清单3显示了我们的测试类的源代码:Neo4jClient。 清单1. Initializes the Neo4j Driver. */ public Neo4jClient() { // Create the Neo4j driver } /** * Test methods */ public static void main(String ... args) { Neo4jClient client = new Neo4jClient(); client.createPerson(new Person("Duke", 22)); Set<Person Neo4jClient应用程序的Maven POM <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3
Neo4jClient – Neo4j的.NET客户端绑定。 npgsql – PostgreSQL的.NET数据提供程序。它允许为.NET框架开发的任何程序访问PostgreSQL数据库服务器。