Cyanide.Cypher 4.4.2

dotnet add package Cyanide.Cypher --version 4.4.2
                    
NuGet\Install-Package Cyanide.Cypher -Version 4.4.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="Cyanide.Cypher" Version="4.4.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cyanide.Cypher" Version="4.4.2" />
                    
Directory.Packages.props
<PackageReference Include="Cyanide.Cypher" />
                    
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 Cyanide.Cypher --version 4.4.2
                    
#r "nuget: Cyanide.Cypher, 4.4.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.
#addin nuget:?package=Cyanide.Cypher&version=4.4.2
                    
Install Cyanide.Cypher as a Cake Addin
#tool nuget:?package=Cyanide.Cypher&version=4.4.2
                    
Install Cyanide.Cypher as a Cake Tool

Cyanide.Cypher

Cypher query builder is a lightweight and intuitive C# library designed to construct Cypher queries programmatically for use with Neo4j graph database. It simplifies query creation by providing a fluent and type-safe API, allowing developers to focus on query logic rather than string concatenation.

Features

  • Fluent query builder: Easily construct Cypher queries using a fluent API.
  • Customizable general clauses / subclauses: Support for the following Cypher clauses:
    • MATCH,OPTIONAL MATCH
    • CREATE
    • RETURN
    • WHERE (IS NOT NULL,IS NULL, OR,XOR,NOT)
    • WITH (functions toUpper,count)
    • SKIP
    • LIMIT
    • SET
    • SKIP
    • REMOVE
    • ORDER BY
    • DELETE,DETACH DELETE
    • UNION,UNION ALL
  • Customizable administrative clauses: Support for the following Cypher clauses (limited support):
    • SHOW CURRENT USER,SHOW USERS
    • SHOW DATABASE,SHOW DATABASES
    • CREATE USER,CREATE OR REPLACE USER
    • CREATE DATABASE
    • START DATABASE
    • STOP DATABASE
    • ALTER DATABASE
    • DROP DATABASE

More information about clauses is available an official site

Getting Started

Prerequisites

  • .NET 8 or higher.
  • A running instance of a Neo4j database:
    • version 4.4

Usage

See more details about all clauses with the project link.

Create a general builder

using Cyanide.Cypher.Builders;
using Cyanide.Cypher.Builders.Queries.General;

IQuery queryBuilder = Factory.QueryBuilder()

Sample

var resultQuery = _queryBuilder
    .Match(q =>
        q.WithNode(new Entity("Person", "a", [new Field("name", "'Martin Sheen'")]))
    )
    .Return(q =>
        q.WithField("name", "a")
    )
    .Build();

Output:

MATCH (a:Person {name: 'Martin Sheen'}) RETURN a.name

Create an administrative builder

using Cyanide.Cypher.Builders;
using Cyanide.Cypher.Builders.Queries.Admin;

IAdminQuery adminQueryBuilder = Factory.AdminQueryBuilder();

Sample

var resultQuery = _adminQueryBuilder
    .Show(q =>
        q.WithDatabases()
    )
    .Build();

Output:

SHOW DATABASES

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

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
4.4.2 95 1/26/2025
4.4.1 82 1/26/2025
4.4.0 87 1/26/2025

- Added support for .NET 8.0;
           - Added support for Neo4j 4.4;
           - Support the general (sub)clauses: MATCH, OPTIONAL MATCH, CREATE, WHERE, WITH, SET, SKIP, LIMIT, REMOVE, DELETE, DETACH DELETE, ORDER BY, UNION, UNION ALL;
           - Support the administrative clauses: SHOW DATABASE, SHOW DATABASES, SHOW CURRENT USER, SHOW USERS, CREATE USER, CREATE OR REPLACE USER, CREATE DATABASE, STOP DATABASE, START DATABASE, DROP DATABASE, ALTER DATABASE;