Skip to content

ambystechcom/Ambystech.Neo4j.Repository

Repository files navigation

Ambystech.Neo4j.Repository

Ambystech.Neo4j.Repository

Neo4j Repository pattern implementation for .NET.

Overview

This library provides a repository implementation for Neo4j graph databases, enabling easy CRUD operations, relationship management, and search functionality.

Packages

  • Ambystech.Neo4j.Repository - Main repository implementation
  • Ambystech.Neo4j.Repository.Contracts - Base contracts and attributes

Installation

dotnet add package Ambystech.Neo4j.Repository
dotnet add package Ambystech.Neo4j.Repository.Contracts

Quick Start

  1. Configure Neo4j connection in appsettings.json or user secrets:
{
  "Neo4j-Uri": "bolt://localhost:7687",
  "Neo4j-User": "neo4j",
  "Neo4j-Password": "password"
}
  1. Register services:
builder.Services.AddNeo4jRepository();
builder.Services.AddSingleton<INodeConverter<YourEntity>, YourEntityConverter>();
builder.Services.AddScoped<IBaseGraphRepository<YourEntity>, YourEntityRepository>();
  1. Use the repository:
var repository = serviceProvider.GetRequiredService<IBaseGraphRepository<YourEntity>>();
var entities = await repository.GetAllAsync();

Features

  • Generic CRUD operations
  • Relationship management
  • Search and filtering
  • Soft delete support
  • Automatic relationship loading.

Example

See the example/ directory for a complete working example with a social network graph (Users, Posts, Likes, Dislikes).

Example Graph

License

MIT License - see LICENSE file for details.

About

A lightweight and flexible generic repository pattern implementation for Neo4j, built in C# for .NET, designed to simplify data access, promote clean architecture, and enable reusable, maintainable graph-based applications.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors