Neo4j Repository pattern implementation for .NET.
This library provides a repository implementation for Neo4j graph databases, enabling easy CRUD operations, relationship management, and search functionality.
- Ambystech.Neo4j.Repository - Main repository implementation
- Ambystech.Neo4j.Repository.Contracts - Base contracts and attributes
dotnet add package Ambystech.Neo4j.Repository
dotnet add package Ambystech.Neo4j.Repository.Contracts- Configure Neo4j connection in
appsettings.jsonoruser secrets:
{
"Neo4j-Uri": "bolt://localhost:7687",
"Neo4j-User": "neo4j",
"Neo4j-Password": "password"
}- Register services:
builder.Services.AddNeo4jRepository();
builder.Services.AddSingleton<INodeConverter<YourEntity>, YourEntityConverter>();
builder.Services.AddScoped<IBaseGraphRepository<YourEntity>, YourEntityRepository>();- Use the repository:
var repository = serviceProvider.GetRequiredService<IBaseGraphRepository<YourEntity>>();
var entities = await repository.GetAllAsync();- Generic CRUD operations
- Relationship management
- Search and filtering
- Soft delete support
- Automatic relationship loading.
See the example/ directory for a complete working example with a social network graph (Users, Posts, Likes, Dislikes).
MIT License - see LICENSE file for details.
