EdgeDB.Net is the official .NET driver for the EdgeDB database.
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.DriverA 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();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);var result = await client.QueryAsync<long>("select 2 + 2"); // 4Note
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.
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!
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 buildYou can run the test suite by using the dotnet test command like so:
$ dotnet test