An open API service indexing awesome lists of open source software.

https://github.com/geldata/gel-net

The official .NET client library for EdgeDB
https://github.com/geldata/gel-net

cs csharp database dotnet edgedb efcore fs fsharp

Last synced: about 1 month ago
JSON representation

The official .NET client library for EdgeDB

Awesome Lists containing this project

README

        

![Gel.Net](https://raw.githubusercontent.com/geldata/gel-net/dev/branding/Banner.png)



Downloads


NuGet


Tests


Discord


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

## Installation

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

```bash
$ dotnet add package Gel.Net.Driver
```

## Basic usage

### Creating a client

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

```cs
using Gel;

var client = new GelClientPool();
```

### Client configuration

`GelClientPool` will automatically determine how to connect to your Gel
instance by resolving [Gel Projects](https://docs.geldata.com/learn/projects).
For specifying custom connection arguments, considering checking out the
`GelConnection` class. Here's an example of using the `.Create()` method:

```cs
using Gel;

var connection = GelConnection.Create(
new GelConnection.Options(){dsn="gel://user:password@localhost:5656/mybranch"}
);
var client = new GelClientPool(connection);
```

### Executing queries

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

Queries are executed through the `GelClientPool` by using different helper
methods. Your choice of method is dependent on the kind of query you're making,
better known as [cardinality](https://docs.geldata.com/reference/edgeql/sets#everything-is-a-set).

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

```cs
var result = await client.QueryAsync("select 2 + 2"); // returns 4
```

## Contributing

We openly welcome and accept contributions to Gel.Net! Before writing a
GitHub Issue or Pull Request, please see our [contribution requirements](CONTRIBUTING.md).

## Examples

This repository contains a list of [working examples](examples),
check them out to see Gel.Net in action!

## Compiling

If you're building Gel.Net from source, you will need to download the
[.NET 8 SDK](https://dotnet.microsoft.com/en-us/download).

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

```bash
$ dotnet build
```

## Testing

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

```bash
$ dotnet test
```