Skip to content

edgedb/edgedb-net

Repository files navigation

EdgeDB.Net

Downloads NuGet Tests Discord

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

Documentation

Documentation for the dotnet driver can be found here.

Installation

EdgeDB.Net is distributed through the NuGet package manager. We recommend using the dotnet command or NuGet package manager in Visual Studio:

$ dotnet add package EdgeDB.Net.Driver

Basic usage

Creating a client

Clients are what allow your code to talk and interface with EdgeDB. The EdgeDBClient class contains a pool of connections and numerous abstractions for executing queries with ease:

using EdgeDB;

var client = new EdgeDBClient();

Client configuration

EdgeDBClient will automatically determine how to connect to your EdgeDB instance by resolving EdgeDB Projects. For specifying custom connection arguments, considering checking out the EdgeDBConnection class. Here's an example of using the .Parse() method:

using EdgeDB;

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

Executing queries

Note: EdgeDB.Net is a fully asynchronous driver, and as such, all I/O operations are performed asynchronously.

Queries are executed through the EdgeDBClient by using different helper methods. Your choice of method is dependent on the kind of query you're making, better known as cardinality.

Query helper methods will expect a generic T type which is the .NET version of an EdgeDB type:

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

Contributing

We openly welcome and accept contributions to EdgeDB.Net! Before writing a GitHub Issue or Pull Request, please see our contribution requirements.

Examples

This repository contains a list of working examples, check them out to see EdgeDB.Net in action!

Compiling

If you're building EdgeDB.Net from source, you will need to download the .NET 6 SDK.

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

$ dotnet build

Testing

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

$ dotnet test