KubaZ2/edgedb-net

The official .NET client library for EdgeDB

★ 0Forks 0GitHub ↗Compare

Project website ↗

README

EdgeDB.Net

NuGet Tests Discord

EdgeDB.Net is the official .NET driver for the EdgeDB database.

Installation

EdgeDB DotNet is distributed through the NuGet package manager; the most recommended way to install it is to use the dotnet command line tool or NuGet package manager in Visual Studio.

$ dotnet add package EdgeDB.Net.Driver

Basic usage

Create a client

A client is what allows your code to talk with EdgeDB. The EdgeDBClient class maintains a pool of connections and provides abstractions for executing queries with ease.

using EdgeDB;

var client = new EdgeDBClient();

Configuring the client

The EdgeDBClient automatically determines how to connect to your edgedb database, using EdgeDB Projects. If you want to specify custom connection arguments, you can use the static EdgeDBConnection.Parse() method.

using EdgeDB;

var connection = EdgeDBConnection.Parse("edgedb://user:password@localhost:5656/mydb");
var client = new EdgeDBClient(connection);

Querying the database

var result = await client.QueryAsync<long>("select 2 + 2"); // 4

Note The QueryAsync method always returns a IReadOnlyCollection<T>, regardless of actual query cardinality. If you want to explicitly define cardinality when querying, you can use the QuerySingleAsync or QueryRequiredSingle methods.

Note EdgeDB.Net is a fully asynchronous driver, and as such, all IO operations are performed asynchronously.

Examples

You can view our curated examples here. We also have a demo asp.net project you can view here. You're more than welcome to contribute to the examples!

Compiling

If you want to build the EdgeDB.Net project from source, you will need the .NET 6 SDK.

Once you have the SDK installed you can run the dotnet build command in the root directory of the project:

$ dotnet build

Testing

You can run the test suite by using the dotnet test command like so:

$ dotnet test

Contributors

quinchsgithub-actions[bot]jaclarkejustsloncsmirkylejuliandevi0bsSyzuna

Issues