NorthernNerds.Aspire.Neo4j is an unofficial Aspire client integration for Neo4j. This package provides the client-side components needed to connect to Neo4j in your Aspire services.
- Register Neo4j client in your service projects
- Automatic injection of configured
IDriver
- Integration with Aspire service discovery
dotnet add package NorthernNerds.Aspire.Neo4j
In your service project:
using NorthernNerds.Aspire.Neo4j;
var builder = WebApplication.CreateBuilder(args);
builder.AddNeo4jClient("graph-db");
Use the injected IDriver
in your services:
using Neo4j.Driver;
public class MyService
{
private readonly IDriver _driver;
public MyService(IDriver driver)
{
_driver = driver;
}
public async Task DoSomething()
{
var session = _driver.AsyncSession();
await session.RunAsync("MATCH (n) RETURN n");
}
}
Northern Nerds is a one-man freelance software company dedicated to creating high-quality software solutions. For more integrations and tools, follow our work!