ManagedCode.GraphRag.Neo4j 0.0.2

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package ManagedCode.GraphRag.Neo4j --version 0.0.2
                    
NuGet\Install-Package ManagedCode.GraphRag.Neo4j -Version 0.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ManagedCode.GraphRag.Neo4j" Version="0.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ManagedCode.GraphRag.Neo4j" Version="0.0.2" />
                    
Directory.Packages.props
<PackageReference Include="ManagedCode.GraphRag.Neo4j" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ManagedCode.GraphRag.Neo4j --version 0.0.2
                    
#r "nuget: ManagedCode.GraphRag.Neo4j, 0.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ManagedCode.GraphRag.Neo4j@0.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ManagedCode.GraphRag.Neo4j&version=0.0.2
                    
Install as a Cake Addin
#tool nuget:?package=ManagedCode.GraphRag.Neo4j&version=0.0.2
                    
Install as a Cake Tool

GraphRAG for .NET

GraphRAG for .NET is a ground-up port of Microsoft’s original GraphRAG Python reference implementation to the modern .NET 9 stack.
Our goal is API parity with the Python pipeline while embracing native .NET idioms (dependency injection, logging abstractions, async I/O, etc.).
The upstream Python code remains available in submodules/graphrag-python for side-by-side reference during the migration.


Repository Structure

graphrag/
├── GraphRag.slnx                          # Single solution covering every project
├── Directory.Build.props / Directory.Packages.props
├── src/
│   ├── ManagedCode.GraphRag               # Core pipeline orchestration & abstractions
│   ├── ManagedCode.GraphRag.CosmosDb      # Azure Cosmos DB graph adapter
│   ├── ManagedCode.GraphRag.Neo4j         # Neo4j adapter & bolt client integration
│   └── ManagedCode.GraphRag.Postgres      # Apache AGE/PostgreSQL graph store adapter
├── tests/
│   └── ManagedCode.GraphRag.Tests
│       ├── Integration/                   # Live container-backed scenarios (Testcontainers)
│       └── … unit-level suites
└── submodules/
    └── graphrag-python                    # Original Python implementation (read-only reference)

Key Components

  • ManagedCode.GraphRag
    Hosts the pipelines, workflow execution model, and shared contracts such as IGraphStore, IPipelineCache, etc.

  • ManagedCode.GraphRag.Neo4j / .Postgres / .CosmosDb
    Concrete graph-store adapters that satisfy the core abstractions. Each hides the backend-specific SDK plumbing and exposes .AddXGraphStore(...) DI helpers.

  • ManagedCode.GraphRag.Tests
    Our only test project.
    Unit tests ensure helper APIs behave deterministically.
    The Integration/ folder spins up real infrastructure (Neo4j, Apache AGE/PostgreSQL, optional Cosmos) via Testcontainers—no fakes or mocks.


Prerequisites

Requirement Notes
.NET SDK 9.0 The solution targets net9.0; install previews where necessary.
Docker Desktop / compatible container runtime Required for Testcontainers-backed integration tests (Neo4j & Apache AGE/PostgreSQL).
(Optional) Azure Cosmos DB Emulator Set COSMOS_EMULATOR_CONNECTION_STRING to enable Cosmos tests; they are skipped when the env var is absent.

Getting Started

  1. Clone the repository

    git clone https://github.com/<your-org>/graphrag.git
    cd graphrag
    git submodule update --init --recursive
    
  2. Restore & build

    dotnet build GraphRag.slnx
    

    Repository rule: always build the solution before running tests.

  3. Run the full test suite

    dotnet test GraphRag.slnx --logger "console;verbosity=minimal"
    

    This command will:

    • Restore packages
    • Launch Neo4j and Apache AGE/PostgreSQL containers via Testcontainers
    • Execute unit + integration tests from ManagedCode.GraphRag.Tests
    • Tear down containers automatically when finished
  4. Limit to a specific integration area (optional)

    dotnet test tests/ManagedCode.GraphRag.Tests/ManagedCode.GraphRag.Tests.csproj \
        --filter "FullyQualifiedName~PostgresGraphStoreIntegrationTests" \
        --logger "console;verbosity=normal"
    

Integration Testing Strategy

  • No fakes. We removed the legacy fake Postgres store. Every graph operation in tests uses real services orchestrated by Testcontainers.
  • Security coverage. Integration/PostgresGraphStoreIntegrationTests.cs includes payloads that mimic SQL/Cypher injection attempts to ensure values remain literals and labels/types are strictly validated.
  • Cross-backend validation. Integration/GraphStoreIntegrationTests.cs exercises Postgres, Neo4j, and Cosmos (when available) through the shared IGraphStore abstraction.
  • Workflow smoke tests. Pipelines (e.g., IndexingPipelineRunnerTests) and finalization steps run end-to-end with the fixture-provisioned infrastructure.

Local Cosmos Testing

  1. Install and start the Azure Cosmos DB Emulator.
  2. Export the connection string:
    export COSMOS_EMULATOR_CONNECTION_STRING="AccountEndpoint=https://localhost:8081/;AccountKey=…;"
    
  3. Rerun dotnet test; Cosmos scenarios will seed databases & verify relationships without additional setup.

Development Tips

  • Solution layout. Use GraphRag.slnx in Visual Studio/VS Code/Rider for a complete workspace view.
  • Formatting / analyzers. Run dotnet format GraphRag.slnx before committing to satisfy the repo analyzers.
  • Coding conventions.
    • nullable and implicit usings are enabled; keep annotations accurate.
    • Async methods should follow the Async suffix convention.
    • Prefer DI helpers in ManagedCode.GraphRag when wiring new services.
  • Graph adapters. Implement additional backends by conforming to IGraphStore and registering via IServiceCollection.

Contributing

  1. Fork and clone the repo.
  2. Create a feature branch from main.
  3. Follow the repository rules (build before testing; integration tests must use real containers).
  4. Submit a PR referencing any related issues. Include dotnet test GraphRag.slnx output in the PR body.

See CONTRIBUTING.md for coding standards and PR expectations.


License & Credits

  • Licensed under the MIT License.
  • Original Python implementation © Microsoft; see the graphrag-python submodule for upstream documentation and examples.

Have questions or found a bug? Open an issue or start a discussion—we’re actively evolving the .NET port and welcome feedback. 🚀

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.4 133 10/31/2025
0.0.3 166 10/30/2025
0.0.2 163 10/28/2025
0.0.1 164 10/27/2025